Code Monkey home page Code Monkey logo

stable-diffusion-discord-bot's Introduction

Hi 👋, I'm Timon Käch

Full stack developer and owner of CyberTimon

  • 🔭 I’m currently working on CT AI - An ai plattform which operates completely offline.

  • 🌱 I’m currently learning Machine Learning with PyTorch

  • 🚗 I created this racing game StylizedDrift

  • 📫 How to reach me [email protected]

  • ⚡ Fun fact 8B Parameters Are All You Need

Experience

  • Game Developer, (2019 - 2022)

    • Created a racing game called StylizedDrift using Unity.
    • Coded various game knock-off's like FallMönsch
    • Unreal Engine experience
    • Made 3D projects and games for friends
  • Web Development, (2020 - Present)

    • Learned Wordpress and made various sites with it
    • Experience in Flask and the frontend stack
    • Started with Python
    • Experience in ServiceNow and JavaScript
  • Hack Small Things, (Indefinite duration)

    • I love Hackintosh
    • Installed Minecraft on smartwatches
    • Decompiling software
    • Overclocking and modding graphics cards
  • Machine Learning Enthusiast, (2022 - Present)

    • Started getting interested in machine learning
    • Trained various image and text based AI models
    • Started coding my AI platform CT AI
    • Built myself a powerful home server
    • Contributed to Open Assistant (Contributors)
  • Computer Scientist, (Present)

    • Pursuing an apprenticeship.

Want to support me?

ko-fi

stable-diffusion-discord-bot's People

Contributors

cybertimon avatar intensesunlight avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

stable-diffusion-discord-bot's Issues

Improvement Suggestion

I have two suggestions but first amazing bot man honestly simple and well made.

Okay the first suggestion I'd like to make is when the user clicks retry to generate more images with the same prompt. There is an issue where the new images are generated and it gives u the option to upscale the new images but not an option to retry again and again.

The second feature is it possible to generate 4 images at a time instead of the 2 with the necessary button for upscaling for the addition other two.

Response code=404

10/22/23 12:46:59: Started App
10/22/23 12:46:59: Connected to SD host on URL: http://127.0.0.1:7860
10/22/23 12:46:59: Did not receive correct response from SD host: http://127.0.0.1:7860
Response code=404

My SD is perfectly reachable over browser and this URL/Port.
Running on Windows 11, also disabled all SD Extensions, no difference.

API is enabled in SD Interface

Need help to replace Upscale function with an HiresFix upscale instead. PLEASE <3

Hello there! I've been thoroughly enjoying the base-template of your Bot which I've sort of completely re-shaped to my will. But there's just one thing that I'm really struggling to put into place and I was wondering if I could have your help..

The upscale function, I want it to do an hires-fix instead that I tune to my will:

  "hr_scale": 1.35,
  "hr_upscaler": "4x_NMKD-Superscale-SP_178000_G",
  "denoising_strength": 0.35,```
  
  Issue is, I do not know how to make it work with the current base of the bot.
  

async def imagegen(prompt, orientation, negative_prompt, variation=False):
print(orientation) # debug print statement
global total_requests
total_requests = total_requests + 1
global webui_url
global variation_strength
currentTime = datetime.now()
width, height = make_orientation(orientation)
with open('gen_settings.json') as json_file:
data = json.load(json_file)
default = data["default"]
enable_hr_value = data["enable_hr"]
hr_scale_value = data["hr_scale"]
hr_upscaler_value = data["hr_upscaler"]
hr_denoise_value = data["denoising_strength"]
add_prompt_txt = data["add_prompt"]
if variation:
variation_strength = variation_strength
else:
variation_strength = 0
config = load_config("gen_settings.json")
payload = {
"prompt": prompt + add_prompt_txt,
"negative_prompt" : negative_prompt,
"width": width,
"height": height,
"enable_hr": enable_hr_value,
"hr_scale": hr_scale_value,
"hr_upscaler": hr_upscaler_value,
"denoising_strength": hr_denoise_value,
"subseed_strength": variation_strength,
**config # Merge the loaded config with the payload
}
async with session.post(url=f'{webui_url}/sdapi/v1/txt2img', json=payload) as response:
r = await response.json()

for i in r['images']:
    image = Image.open(io.BytesIO(base64.b64decode(i.split(",",1)[0])))
    png_payload = {
        "image": "data:image/png;base64," + i
    }
    async with session.post(url=f'{webui_url}/sdapi/v1/png-info', json=png_payload) as response2:
        json_response = await response2.json()
        pnginfo = PngImagePlugin.PngInfo()
        pnginfo.add_text("parameters", json_response.get("info"))
        
        global characters
        image_id = ''.join(random.choice(characters) for i in range(24))
        file_path = f"GeneratedImages/{image_id}.png"
        image.save(file_path, pnginfo=pnginfo)
        print ("Generated Image:", file_path)
        print (total_requests)
        with open('current_requests.txt', 'w') as file:
            file.write(str(total_requests))
        return file_path, image_id

Sends the upscale request to A1111

async def upscale(image):
global total_requests
total_requests = total_requests + 1
with open(image, 'rb') as image_file:
image_b64 = base64.b64encode(image_file.read()).decode()
upscale_payload = {
"upscaling_resize": 2,
"upscaling_crop": True,
"gfpgan_visibility": 0,
"codeformer_visibility": 0,
"codeformer_weight": 0,
"upscaler_1": "4x_NMKD-Siax_200k",
"image": image_b64
}
async with session.post(url=f'{webui_url}/sdapi/v1/extra-single-image', json=upscale_payload) as response_upscaled:
r_u = await response_upscaled.json()
image_bytes = base64.b64decode(r_u['image'])
image_upscaled = Image.open(io.BytesIO(image_bytes))
file_path = image
file_path = file_path.replace('.png', '')
file_path = f"{file_path}-upscaled.png"
image_upscaled.save(file_path)
print ("Upscaled Image:", file_path)
print (total_requests)
with open('current_requests.txt', 'w') as file:
file.write(str(total_requests))
return file_path
```

    I'd just appreciate it to have the very bare minimum of help with this. Just the foundation, would help greatly. THanks in advance.
    Also great work !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.