fffiloni commited on
Commit
82c8bea
1 Parent(s): 6e58b1f

Update app_gradio.py

Browse files
Files changed (1) hide show
  1. app_gradio.py +19 -21
app_gradio.py CHANGED
@@ -207,10 +207,10 @@ def generate_output_from_sketchpad(image, prompt: str, num_seeds: int = 3, lambd
207
 
208
  css=""" """
209
 
210
- def create_gradio_interface():
211
- with gr.Blocks(css=css) as demo:
212
- with gr.Column():
213
- gr.Markdown(
214
  """
215
 
216
  <div align="center" id = "user-content-toc">
@@ -221,7 +221,7 @@ def create_gradio_interface():
221
  </div>
222
 
223
  """
224
- )
225
 
226
  with gr.Tab("Main"):
227
 
@@ -336,8 +336,8 @@ def create_gradio_interface():
336
 
337
 
338
 
339
- # Event handlers
340
- generate_btn.click(
341
  fn=generate_output,
342
  inputs=[
343
  input_sketch,
@@ -346,22 +346,22 @@ def create_gradio_interface():
346
  lambda_
347
  ],
348
  outputs=output_gallery
349
- )
350
- def reload_pad():
351
- blank_pad ={
352
- "background": "./static/examples/background.jpeg",
353
- "layers": None,
354
- "composite": None
355
- }
356
- return blank_pad
357
 
358
- draw_sketchpad.delete(
359
  fn=reload_pad,
360
  inputs = None,
361
  outputs = [draw_sketchpad],
362
  queue=False
363
- )
364
- sketchpad_generate_btn.click(
365
  fn=generate_output_from_sketchpad,
366
  inputs=[
367
  draw_sketchpad,
@@ -370,13 +370,11 @@ def create_gradio_interface():
370
  draw_lambda_
371
  ],
372
  outputs=output_gallery
373
- )
374
 
375
- return demo
376
 
377
  # Launch the app
378
  if __name__ == "__main__":
379
- demo = create_gradio_interface()
380
  demo.launch(
381
  server_name="0.0.0.0",
382
  server_port=7860,
 
207
 
208
  css=""" """
209
 
210
+
211
+ with gr.Blocks(css=css) as demo:
212
+ with gr.Column():
213
+ gr.Markdown(
214
  """
215
 
216
  <div align="center" id = "user-content-toc">
 
221
  </div>
222
 
223
  """
224
+ )
225
 
226
  with gr.Tab("Main"):
227
 
 
336
 
337
 
338
 
339
+ # Event handlers
340
+ generate_btn.click(
341
  fn=generate_output,
342
  inputs=[
343
  input_sketch,
 
346
  lambda_
347
  ],
348
  outputs=output_gallery
349
+ )
350
+ def reload_pad():
351
+ blank_pad ={
352
+ "background": "./static/examples/background.jpeg",
353
+ "layers": None,
354
+ "composite": None
355
+ }
356
+ return blank_pad
357
 
358
+ draw_sketchpad.delete(
359
  fn=reload_pad,
360
  inputs = None,
361
  outputs = [draw_sketchpad],
362
  queue=False
363
+ )
364
+ sketchpad_generate_btn.click(
365
  fn=generate_output_from_sketchpad,
366
  inputs=[
367
  draw_sketchpad,
 
370
  draw_lambda_
371
  ],
372
  outputs=output_gallery
373
+ )
374
 
 
375
 
376
  # Launch the app
377
  if __name__ == "__main__":
 
378
  demo.launch(
379
  server_name="0.0.0.0",
380
  server_port=7860,