Kims12 commited on
Commit
4458d2d
ยท
verified ยท
1 Parent(s): 23db719

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -206,7 +206,6 @@ def process_and_show_prompt(image1, image2, image3, prompt):
206
  logger.exception("์ฒ˜๋ฆฌ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ:")
207
  return None, f"์˜ค๋ฅ˜ ๋ฐœ์ƒ: {str(e)}", prompt
208
 
209
- # Gradio ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ํ•˜๋‚˜์˜ Blocks()๋กœ ๊ตฌ์„ฑ
210
  with gr.Blocks() as demo:
211
  gr.HTML(
212
  """
@@ -244,7 +243,6 @@ with gr.Blocks() as demo:
244
  )
245
  prompt_display = gr.Textbox(label="Used Prompt (English)", visible=True)
246
 
247
- # ์˜ˆ์ œ ์‹คํ–‰ ์‹œ ์ž๋™์œผ๋กœ image_input ๋ฐ prompt_input์— ๊ฐ’ ์ฑ„์›Œ์ง
248
  gr.Markdown("## Try these examples", elem_classes="gr-examples-header")
249
 
250
  examples = [
@@ -253,14 +251,18 @@ with gr.Blocks() as demo:
253
  ]
254
 
255
  gr.Examples(
 
256
  examples=examples,
257
  inputs=[image_input, prompt_input],
 
 
258
  elem_id="examples-grid"
259
  )
260
 
 
261
  submit_btn.click(
262
- fn=process_and_show_prompt,
263
- inputs=[image_input, None, None, prompt_input],
264
  outputs=[output_gallery, output_text, prompt_display],
265
  )
266
 
 
206
  logger.exception("์ฒ˜๋ฆฌ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ:")
207
  return None, f"์˜ค๋ฅ˜ ๋ฐœ์ƒ: {str(e)}", prompt
208
 
 
209
  with gr.Blocks() as demo:
210
  gr.HTML(
211
  """
 
243
  )
244
  prompt_display = gr.Textbox(label="Used Prompt (English)", visible=True)
245
 
 
246
  gr.Markdown("## Try these examples", elem_classes="gr-examples-header")
247
 
248
  examples = [
 
251
  ]
252
 
253
  gr.Examples(
254
+ fn=lambda img, pr: process_and_show_prompt(img, None, None, pr),
255
  examples=examples,
256
  inputs=[image_input, prompt_input],
257
+ outputs=[output_gallery, output_text, prompt_display],
258
+ run_on_click=True,
259
  elem_id="examples-grid"
260
  )
261
 
262
+ # submit_btn ํด๋ฆญ ์‹œ image2, image3๋Š” None์œผ๋กœ ์ „๋‹ฌ
263
  submit_btn.click(
264
+ fn=lambda img, pr, key: process_and_show_prompt(img, None, None, pr),
265
+ inputs=[image_input, prompt_input, gemini_api_key],
266
  outputs=[output_gallery, output_text, prompt_display],
267
  )
268