Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -77,7 +77,7 @@ def query(prompt, is_negative=False, steps=35, cfg_scale=7, sampler="DPM++ 2M Ka
|
|
77 |
image_bytes = response.content
|
78 |
image = Image.open(io.BytesIO(image_bytes))
|
79 |
print(f'\033[1mGeneration {key} completed!\033[0m ({prompt})')
|
80 |
-
return image
|
81 |
except Exception as e:
|
82 |
print(f"Error when trying to open the image: {e}")
|
83 |
return None
|
@@ -178,21 +178,23 @@ with gr.Blocks(theme=theme, css=css) as app:
|
|
178 |
# Add a text input for the main prompt
|
179 |
with gr.Row():
|
180 |
with gr.Column(elem_id="prompt-container"):
|
181 |
-
with gr.
|
182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
|
184 |
-
# Accordion for advanced settings
|
185 |
-
with gr.Row():
|
186 |
-
with gr.Accordion("Advanced Settings", open=False):
|
187 |
-
negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="What should not be in the image", value="(deformed, distorted, disfigured), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, misspellings, typos", lines=3, elem_id="negative-prompt-text-input")
|
188 |
-
with gr.Row():
|
189 |
-
width = gr.Slider(label="Width", value=1024, minimum=64, maximum=1216, step=32)
|
190 |
-
height = gr.Slider(label="Height", value=1024, minimum=64, maximum=1216, step=32)
|
191 |
-
steps = gr.Slider(label="Sampling steps", value=35, minimum=1, maximum=100, step=1)
|
192 |
-
cfg = gr.Slider(label="CFG Scale", value=7, minimum=1, maximum=20, step=1)
|
193 |
-
strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
|
194 |
-
seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1) # Setting the seed to -1 will make it random
|
195 |
-
method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ 2S a Karras", "DPM2 a Karras", "DPM2 Karras", "DPM++ SDE Karras", "DEIS", "LMS", "DPM Adaptive", "DPM++ 2M", "DPM2 Ancestral", "DPM++ S", "DPM++ SDE", "DDPM", "DPM Fast", "dpmpp_2s_ancestral", "Euler", "Euler CFG PP", "Euler a", "Euler Ancestral", "Euler+beta", "Heun", "Heun PP2", "DDIM", "LMS Karras", "PLMS", "UniPC", "UniPC BH2"])
|
196 |
with gr.Row():
|
197 |
with gr.Accordion("🫘Seed", open=False):
|
198 |
seed_output = gr.Textbox(label="Seed Used", elem_id="seed-output")
|
|
|
77 |
image_bytes = response.content
|
78 |
image = Image.open(io.BytesIO(image_bytes))
|
79 |
print(f'\033[1mGeneration {key} completed!\033[0m ({prompt})')
|
80 |
+
return image, seed
|
81 |
except Exception as e:
|
82 |
print(f"Error when trying to open the image: {e}")
|
83 |
return None
|
|
|
178 |
# Add a text input for the main prompt
|
179 |
with gr.Row():
|
180 |
with gr.Column(elem_id="prompt-container"):
|
181 |
+
with gr.Group():
|
182 |
+
with gr.Row():
|
183 |
+
text_prompt = gr.Textbox(label="Image Prompt ✍️", placeholder="Enter a prompt here", lines=2, show_copy_button = True, elem_id="prompt-text-input")
|
184 |
+
|
185 |
+
# Accordion for advanced settings
|
186 |
+
with gr.Row():
|
187 |
+
with gr.Accordion("Advanced Settings", open=False):
|
188 |
+
negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="What should not be in the image", value="(deformed, distorted, disfigured), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, misspellings, typos", lines=3, elem_id="negative-prompt-text-input")
|
189 |
+
with gr.Row():
|
190 |
+
width = gr.Slider(label="Width", value=1024, minimum=64, maximum=1216, step=32)
|
191 |
+
height = gr.Slider(label="Height", value=1024, minimum=64, maximum=1216, step=32)
|
192 |
+
steps = gr.Slider(label="Sampling steps", value=35, minimum=1, maximum=100, step=1)
|
193 |
+
cfg = gr.Slider(label="CFG Scale", value=7, minimum=1, maximum=20, step=1)
|
194 |
+
strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
|
195 |
+
seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1) # Setting the seed to -1 will make it random
|
196 |
+
method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ 2S a Karras", "DPM2 a Karras", "DPM2 Karras", "DPM++ SDE Karras", "DEIS", "LMS", "DPM Adaptive", "DPM++ 2M", "DPM2 Ancestral", "DPM++ S", "DPM++ SDE", "DDPM", "DPM Fast", "dpmpp_2s_ancestral", "Euler", "Euler CFG PP", "Euler a", "Euler Ancestral", "Euler+beta", "Heun", "Heun PP2", "DDIM", "LMS Karras", "PLMS", "UniPC", "UniPC BH2"])
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
with gr.Row():
|
199 |
with gr.Accordion("🫘Seed", open=False):
|
200 |
seed_output = gr.Textbox(label="Seed Used", elem_id="seed-output")
|