abreza commited on
Commit
ba6c7b6
·
1 Parent(s): 4a082ed

fix selected_image

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -228,17 +228,12 @@ with gr.Blocks() as demo:
228
  with gr.Row():
229
  num_images = gr.Slider(
230
  label="Number of Images", minimum=1, maximum=8, step=1, value=4, interactive=True)
231
- height = gr.Number(label="Image Height",
232
- value=1024, interactive=True)
233
- width = gr.Number(label="Image Width",
234
- value=1024, interactive=True)
235
  prompt = gr.Text(
236
  label="Prompt", value="a photo of a cat", interactive=True)
237
- seed = gr.Number(label="Seed", value=3413, interactive=True)
238
  generate_2d_btn = gr.Button(value="Generate 2D Images")
239
 
240
  with gr.Row():
241
- generated_images = gr.Gallery(height=1024)
242
 
243
  with gr.Row():
244
  selected_image = gr.Image(
@@ -295,14 +290,14 @@ with gr.Blocks() as demo:
295
 
296
  generate_2d_btn.click(
297
  fn=process_image,
298
- inputs=[num_images, height, width, prompt, seed],
299
  outputs=[generated_images]
300
  )
301
 
302
  def select_image(evt: gr.SelectData):
303
  return evt.value['image']['url']
304
 
305
- generated_images.select(select_image, generated_images, [selected_image])
306
 
307
  generate_3d_btn.click(fn=check_input_image, inputs=[selected_image]).success(
308
  fn=preprocess,
 
228
  with gr.Row():
229
  num_images = gr.Slider(
230
  label="Number of Images", minimum=1, maximum=8, step=1, value=4, interactive=True)
 
 
 
 
231
  prompt = gr.Text(
232
  label="Prompt", value="a photo of a cat", interactive=True)
 
233
  generate_2d_btn = gr.Button(value="Generate 2D Images")
234
 
235
  with gr.Row():
236
+ generated_images = gr.Gallery(height=512)
237
 
238
  with gr.Row():
239
  selected_image = gr.Image(
 
290
 
291
  generate_2d_btn.click(
292
  fn=process_image,
293
+ inputs=[num_images, 512, 512, prompt, 123],
294
  outputs=[generated_images]
295
  )
296
 
297
  def select_image(evt: gr.SelectData):
298
  return evt.value['image']['url']
299
 
300
+ generated_images.select(select_image, None, selected_image)
301
 
302
  generate_3d_btn.click(fn=check_input_image, inputs=[selected_image]).success(
303
  fn=preprocess,