Kims12 commited on
Commit
23db719
ยท
verified ยท
1 Parent(s): 2eeb3ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -15
app.py CHANGED
@@ -206,21 +206,7 @@ def process_and_show_prompt(image1, image2, image3, prompt):
206
  logger.exception("์ฒ˜๋ฆฌ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ:")
207
  return None, f"์˜ค๋ฅ˜ ๋ฐœ์ƒ: {str(e)}", prompt
208
 
209
- # ์˜ˆ์ œ ์ ์šฉ ๋ถ€๋ถ„ (์ฐธ์กฐ ์ฝ”๋“œ ์ ์šฉ)
210
- gr.Markdown("## Try these examples", elem_classes="gr-examples-header")
211
-
212
- examples = [
213
- ["down/1_in-1.png", "#1 ์ด๋ฏธ์ง€์˜ [์ฒญ์ƒ‰ ์ƒ์–ด๋ ˆ๊ณ ๋ฅผ ๊ฒ€์€ ๊ณ ๋ž˜๋ ˆ๊ณ ]์œผ๋กœ ๋ณ€๊ฒฝํ•˜๋ผ.", ""],
214
- ["down/2_in-1.png", "#1 ์ด๋ฏธ์ง€์˜ [์ค‘๊ตญ์–ด๋ฅผ ๋ชจ๋‘]๋ฅผ ์ œ๊ฑฐํ•˜๋ผ.", ""],
215
- ]
216
-
217
- gr.Examples(
218
- examples=examples,
219
- inputs=[image_input, prompt_input],
220
- elem_id="examples-grid"
221
- )
222
-
223
- # ๊ธฐ์กด Gradio ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌ์„ฑ (์˜ˆ์ œ ์ ์šฉ ์™ธ ๋‹ค๋ฅธ ์ฝ”๋“œ๋Š” ๊ทธ๋Œ€๋กœ ์œ ์ง€)
224
  with gr.Blocks() as demo:
225
  gr.HTML(
226
  """
@@ -256,7 +242,9 @@ with gr.Blocks() as demo:
256
  label="Gemini Output",
257
  placeholder="Text response will appear here if no image is generated."
258
  )
 
259
 
 
260
  gr.Markdown("## Try these examples", elem_classes="gr-examples-header")
261
 
262
  examples = [
@@ -269,5 +257,11 @@ with gr.Blocks() as demo:
269
  inputs=[image_input, prompt_input],
270
  elem_id="examples-grid"
271
  )
 
 
 
 
 
 
272
 
273
  demo.queue(max_size=50).launch()
 
206
  logger.exception("์ฒ˜๋ฆฌ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ:")
207
  return None, f"์˜ค๋ฅ˜ ๋ฐœ์ƒ: {str(e)}", prompt
208
 
209
+ # Gradio ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ํ•˜๋‚˜์˜ Blocks()๋กœ ๊ตฌ์„ฑ
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  with gr.Blocks() as demo:
211
  gr.HTML(
212
  """
 
242
  label="Gemini Output",
243
  placeholder="Text response will appear here if no image is generated."
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 = [
 
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
 
267
  demo.queue(max_size=50).launch()