Spaces:
Running
Running
salomonsky
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -82,7 +82,7 @@ css = """
|
|
82 |
#col-container{ margin: 0 auto; max-width: 1024px;}
|
83 |
"""
|
84 |
|
85 |
-
with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:
|
86 |
with gr.Column(elem_id="col-container"):
|
87 |
with gr.Row():
|
88 |
with gr.Column(scale=3):
|
@@ -98,7 +98,13 @@ with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:
|
|
98 |
|
99 |
improved_prompt = gr.Textbox(label="Prompt Mejorado", interactive=False)
|
100 |
improve_btn = gr.Button("Mejora mi prompt")
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
reset_btn = gr.Button("Reset")
|
103 |
reset_btn.click(fn=lambda: [prompt.update(""), improved_prompt.update("")], inputs=None, outputs=[prompt, improved_prompt])
|
104 |
|
@@ -112,6 +118,38 @@ with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:
|
|
112 |
reset_advanced = gr.Button("Reset")
|
113 |
reset_advanced.click(fn=lambda: [width.update(1280), height.update(768), scales.update(10), steps.update(20), seed.update(-1)], inputs=None, outputs=[width, height, scales, steps, seed])
|
114 |
|
115 |
-
|
116 |
-
btn.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
demo.launch()
|
|
|
82 |
#col-container{ margin: 0 auto; max-width: 1024px;}
|
83 |
"""
|
84 |
|
85 |
+
with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:
|
86 |
with gr.Column(elem_id="col-container"):
|
87 |
with gr.Row():
|
88 |
with gr.Column(scale=3):
|
|
|
98 |
|
99 |
improved_prompt = gr.Textbox(label="Prompt Mejorado", interactive=False)
|
100 |
improve_btn = gr.Button("Mejora mi prompt")
|
101 |
+
|
102 |
+
def improve_prompt_wrapper(prompt):
|
103 |
+
improved_text = improve_prompt(prompt)
|
104 |
+
return prompt, improved_text
|
105 |
+
|
106 |
+
improve_btn.click(fn=improve_prompt_wrapper, inputs=[prompt], outputs=[prompt, improved_prompt])
|
107 |
+
|
108 |
reset_btn = gr.Button("Reset")
|
109 |
reset_btn.click(fn=lambda: [prompt.update(""), improved_prompt.update("")], inputs=None, outputs=[prompt, improved_prompt])
|
110 |
|
|
|
118 |
reset_advanced = gr.Button("Reset")
|
119 |
reset_advanced.click(fn=lambda: [width.update(1280), height.update(768), scales.update(10), steps.update(20), seed.update(-1)], inputs=None, outputs=[width, height, scales, steps, seed])
|
120 |
|
121 |
+
generating = gr.StatusTracker(label="Generando", status=False)
|
122 |
+
btn = gr.Button("Generar", variant="primary", status_tracker=generating)
|
123 |
+
btn.click(
|
124 |
+
fn=gen,
|
125 |
+
inputs=[
|
126 |
+
prompt,
|
127 |
+
basemodel_choice,
|
128 |
+
width,
|
129 |
+
height,
|
130 |
+
scales,
|
131 |
+
steps,
|
132 |
+
seed,
|
133 |
+
upscale_factor,
|
134 |
+
process_upscale,
|
135 |
+
lora_model_choice,
|
136 |
+
process_lora,
|
137 |
+
],
|
138 |
+
outputs=[output_res],
|
139 |
+
error_handler=error_handler,
|
140 |
+
)
|
141 |
+
|
142 |
+
def check_prompt_change(prompt, previous_prompt):
|
143 |
+
if prompt != previous_prompt:
|
144 |
+
generating.update(status=True)
|
145 |
+
return previous_prompt
|
146 |
+
|
147 |
+
previous_prompt = gr.State("")
|
148 |
+
btn.click(
|
149 |
+
fn=check_prompt_change,
|
150 |
+
inputs=[prompt, previous_prompt],
|
151 |
+
outputs=[previous_prompt],
|
152 |
+
before_fn=True,
|
153 |
+
)
|
154 |
+
|
155 |
demo.launch()
|