Update gradio_app.py

#3
by ysharma HF staff - opened
Files changed (2) hide show
  1. README.md +1 -0
  2. gradio_app.py +5 -17
README.md CHANGED
@@ -4,6 +4,7 @@ emoji: πŸš€
4
  colorFrom: indigo
5
  colorTo: pink
6
  sdk: gradio
 
7
  app_file: gradio_app.py
8
  pinned: false
9
  license: cc-by-sa-3.0
 
4
  colorFrom: indigo
5
  colorTo: pink
6
  sdk: gradio
7
+ sdk_version: 3.50.2
8
  app_file: gradio_app.py
9
  pinned: false
10
  license: cc-by-sa-3.0
gradio_app.py CHANGED
@@ -215,7 +215,7 @@ def run_pipeline(pipeline, cfg, single_image, guidance_scale, steps, seed, crop_
215
  images_pred = [save_image(images_pred[i]) for i in range(bsz)]
216
 
217
  out = images_pred + normals_pred
218
- return out
219
 
220
 
221
  @dataclass
@@ -285,7 +285,7 @@ def run_demo():
285
  gr.Examples(
286
  examples=example_fns,
287
  inputs=[input_image],
288
- outputs=[input_image],
289
  cache_examples=False,
290
  label='Examples (click one of the images below to start)',
291
  examples_per_page=30
@@ -315,27 +315,15 @@ def run_demo():
315
  # crop_size = 192
316
  run_btn = gr.Button('Generate', variant='primary', interactive=True)
317
  with gr.Row():
318
- view_1 = gr.Image(interactive=False, height=240, show_label=False)
319
- view_2 = gr.Image(interactive=False, height=240, show_label=False)
320
- view_3 = gr.Image(interactive=False, height=240, show_label=False)
321
- view_4 = gr.Image(interactive=False, height=240, show_label=False)
322
- view_5 = gr.Image(interactive=False, height=240, show_label=False)
323
- view_6 = gr.Image(interactive=False, height=240, show_label=False)
324
- with gr.Row():
325
- normal_1 = gr.Image(interactive=False, height=240, show_label=False)
326
- normal_2 = gr.Image(interactive=False, height=240, show_label=False)
327
- normal_3 = gr.Image(interactive=False, height=240, show_label=False)
328
- normal_4 = gr.Image(interactive=False, height=240, show_label=False)
329
- normal_5 = gr.Image(interactive=False, height=240, show_label=False)
330
- normal_6 = gr.Image(interactive=False, height=240, show_label=False)
331
-
332
 
333
  first_stage = run_btn.click(fn=partial(preprocess, predictor),
334
  inputs=[input_image, input_processing],
335
  outputs=[processed_image_highres, processed_image], queue=True
336
  ).success(fn=partial(run_pipeline, pipeline, cfg),
337
  inputs=[processed_image_highres, scale_slider, steps_slider, seed, crop_size],
338
- outputs=[view_1, view_2, view_3, view_4, view_5, view_6, normal_1, normal_2, normal_3, normal_4, normal_5, normal_6]
339
  )
340
 
341
  demo.queue().launch(share=True, max_threads=80)
 
215
  images_pred = [save_image(images_pred[i]) for i in range(bsz)]
216
 
217
  out = images_pred + normals_pred
218
+ return images_pred, normals_pred
219
 
220
 
221
  @dataclass
 
285
  gr.Examples(
286
  examples=example_fns,
287
  inputs=[input_image],
288
+ #outputs=[input_image],
289
  cache_examples=False,
290
  label='Examples (click one of the images below to start)',
291
  examples_per_page=30
 
315
  # crop_size = 192
316
  run_btn = gr.Button('Generate', variant='primary', interactive=True)
317
  with gr.Row():
318
+ view_gallery = gr.Gallery(interactive=False,show_label=False, container=True, preview=True, allow_preview=True, height=400)
319
+ normal_gallery = gr.Gallery(interactive=False,show_label=False, container=True, preview=True, allow_preview=True, height=400 )
 
 
 
 
 
 
 
 
 
 
 
 
320
 
321
  first_stage = run_btn.click(fn=partial(preprocess, predictor),
322
  inputs=[input_image, input_processing],
323
  outputs=[processed_image_highres, processed_image], queue=True
324
  ).success(fn=partial(run_pipeline, pipeline, cfg),
325
  inputs=[processed_image_highres, scale_slider, steps_slider, seed, crop_size],
326
+ outputs=[view_gallery, normal_gallery]
327
  )
328
 
329
  demo.queue().launch(share=True, max_threads=80)