Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -60,30 +60,35 @@ def query(prompt, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Ka
|
|
60 |
print(f"Error when trying to open the image: {e}")
|
61 |
return None
|
62 |
|
|
|
|
|
|
|
63 |
with gr.Blocks() as app:
|
64 |
-
gr.HTML("
|
|
|
|
|
|
|
65 |
|
66 |
with gr.Row():
|
67 |
with gr.Column(scale=1):
|
|
|
68 |
with gr.Row():
|
69 |
-
|
70 |
-
|
71 |
-
with gr.
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
generate_button = gr.Button("Generate", elem_id="generate-button")
|
81 |
-
clear_button = gr.Button("Clear", elem_id="clear-button")
|
82 |
|
83 |
with gr.Column(scale=1):
|
84 |
image_output = gr.Image(type="pil", label="Image Output", elem_id="gallery")
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
|
89 |
app.launch(show_api=False, share=False)
|
|
|
60 |
print(f"Error when trying to open the image: {e}")
|
61 |
return None
|
62 |
|
63 |
+
def clear_prompt(prompt):
|
64 |
+
return ""
|
65 |
+
|
66 |
with gr.Blocks() as app:
|
67 |
+
gr.HTML("""
|
68 |
+
<h1 align="center">Dream Generator with Flux</h1>
|
69 |
+
<h2 align="center">Transforma tus sueños en imágenes vibrantes con un solo clic.</h2>
|
70 |
+
""")
|
71 |
|
72 |
with gr.Row():
|
73 |
with gr.Column(scale=1):
|
74 |
+
text_prompt = gr.Textbox(label="Prompt", placeholder="Enter a prompt here", lines=2, elem_id="prompt-text-input")
|
75 |
with gr.Row():
|
76 |
+
with gr.Column(scale=1):
|
77 |
+
clear_button = gr.Button("Clear", elem_id="clear-button", variant="secondary")
|
78 |
+
with gr.Column(scale=1):
|
79 |
+
generate_button = gr.Button("Generate", elem_id="generate-button", variant="primary", color="green")
|
80 |
+
with gr.Accordion("Advanced Settings", open=False):
|
81 |
+
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")
|
82 |
+
steps = gr.Slider(label="Sampling steps", value=35, minimum=1, maximum=100, step=1)
|
83 |
+
cfg = gr.Slider(label="CFG Scale", value=7, minimum=1, maximum=20, step=1)
|
84 |
+
method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
|
85 |
+
strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
|
86 |
+
seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
|
|
|
|
|
87 |
|
88 |
with gr.Column(scale=1):
|
89 |
image_output = gr.Image(type="pil", label="Image Output", elem_id="gallery")
|
90 |
+
|
91 |
+
clear_button.click(fn=clear_prompt, inputs=text_prompt, outputs=text_prompt)
|
92 |
+
generate_button.click(fn=query, inputs=[text_prompt, negative_prompt, steps, cfg, method, seed, strength], outputs=image_output)
|
93 |
|
94 |
app.launch(show_api=False, share=False)
|