salomonsky commited on
Commit
abfc2ce
1 Parent(s): 58314c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -14
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: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):
@@ -118,8 +118,13 @@ with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:with gr.Blocks(css=cs
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=[
@@ -137,19 +142,8 @@ with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:with gr.Blocks(css=cs
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()
 
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):
 
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
+ prompt_state = gr.State("")
122
  generating = gr.StatusTracker(label="Generando", status=False)
123
  btn = gr.Button("Generar", variant="primary", status_tracker=generating)
124
+
125
+ def reset_prompt():
126
+ return "", False
127
+
128
  btn.click(
129
  fn=gen,
130
  inputs=[
 
142
  ],
143
  outputs=[output_res],
144
  error_handler=error_handler,
145
+ after_fn=reset_prompt,
146
+ outputs_after_fn=[prompt_state, generating],
147
  )
148
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  demo.launch()