JeCabrera commited on
Commit
deb7544
·
verified ·
1 Parent(s): 211de11

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -23
app.py CHANGED
@@ -61,30 +61,29 @@ def query(prompt, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Ka
61
  return None
62
 
63
  with gr.Blocks() as app:
64
- gr.HTML("""
65
- <center><h1 style="color: #f28f8f;">Dream Generator with Flux</h1></center>
66
- <center><h2 style="color: #333333;">Transforma tus sueños en imágenes vibrantes con un solo clic.</h2></center>
67
- """)
68
 
69
- with gr.Column():
70
- with gr.Row():
71
- with gr.Column():
72
- with gr.Row():
73
- text_prompt = gr.Textbox(label="Prompt", placeholder="Enter a prompt here", lines=2)
74
- with gr.Row():
75
- with gr.Accordion("Advanced Settings", open=False):
76
- 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)
77
- steps = gr.Slider(label="Sampling steps", value=35, minimum=1, maximum=100, step=1)
78
- cfg = gr.Slider(label="CFG Scale", value=7, minimum=1, maximum=20, step=1)
79
- method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
80
- strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
81
- seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
82
 
83
- with gr.Row():
84
- text_button = gr.Button("Run", variant='primary')
85
- with gr.Row():
86
- image_output = gr.Image(type="pil", label="Image Output")
87
-
88
- text_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, seed, strength], outputs=image_output)
 
 
 
89
 
90
  app.launch(show_api=False, share=False)
 
61
  return None
62
 
63
  with gr.Blocks() as app:
64
+ gr.HTML("<center><h1>Dream Generator with Flux</h1><h2>Transforma tus sueños en imágenes vibrantes con un solo clic.</h2></center>")
 
 
 
65
 
66
+ with gr.Row():
67
+ with gr.Column(scale=1):
68
+ with gr.Row():
69
+ text_prompt = gr.Textbox(label="Prompt", placeholder="Enter a prompt here", lines=2, elem_id="prompt-text-input")
70
+ with gr.Row():
71
+ with gr.Accordion("Advanced Settings", open=False):
72
+ 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")
73
+ steps = gr.Slider(label="Sampling steps", value=35, minimum=1, maximum=100, step=1)
74
+ cfg = gr.Slider(label="CFG Scale", value=7, minimum=1, maximum=20, step=1)
75
+ method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
76
+ strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
77
+ seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
 
78
 
79
+ with gr.Row():
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
+ generate_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, seed, strength], outputs=image_output)
87
+ clear_button.click(lambda: (None, None), outputs=[text_prompt, negative_prompt, steps, cfg, method, seed, strength, image_output])
88
 
89
  app.launch(show_api=False, share=False)