Yuukinarak commited on
Commit
048edc5
·
verified ·
1 Parent(s): 86ba7a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -35,13 +35,17 @@ with gr.Blocks() as demo:
35
  # ช่องข้อความที่ใช้รับ Prompt จากผู้ใช้
36
  prompt_input = gr.Textbox(label='Prompt Input Text. 77 Token (Keyword or Symbol) Maximum')
37
 
38
- # รูปภาพที่สามารถคลิกได้เพื่ออัปเดตข้อความใน Prompt
39
- image1 = gr.Image(value="Img/img1.jpg", label="Click to send 'bedroom'")
40
- image2 = gr.Image(value="Img/img2.jpg", label="Click to send 'modern'")
41
 
42
- # เชื่อมโยงการคลิกของรูปภาพกับการอัปเดตข้อความ
43
- image1.click(fn=update_prompt_textbox, inputs=["bedroom"], outputs=prompt_input)
44
- image2.click(fn=update_prompt_textbox, inputs=["modern"], outputs=prompt_input)
 
 
 
 
45
 
46
  # ส่วนประกอบอื่น ๆ ของ Gradio Interface
47
  gr.Interface(
@@ -65,3 +69,4 @@ with gr.Blocks() as demo:
65
 
66
  # เริ่มการทำงานของ UI
67
  demo.launch()
 
 
35
  # ช่องข้อความที่ใช้รับ Prompt จากผู้ใช้
36
  prompt_input = gr.Textbox(label='Prompt Input Text. 77 Token (Keyword or Symbol) Maximum')
37
 
38
+ # รูปภาพจากโฟลเดอร์
39
+ image1 = gr.Image(value="Img/img1.jpg", label="Bedroom Image")
40
+ image2 = gr.Image(value="Img/img2.jpg", label="Modern Image")
41
 
42
+ # ปุ่มที่ผู้ใช้จะคลิกเพื่อส่งข้อความ
43
+ button1 = gr.Button("Use 'bedroom' Prompt")
44
+ button2 = gr.Button("Use 'modern' Prompt")
45
+
46
+ # เชื่อมโยงปุ่มกับฟังก์ชันที่ส่งข้อความ
47
+ button1.click(fn=update_prompt_textbox, inputs=["bedroom"], outputs=prompt_input)
48
+ button2.click(fn=update_prompt_textbox, inputs=["modern"], outputs=prompt_input)
49
 
50
  # ส่วนประกอบอื่น ๆ ของ Gradio Interface
51
  gr.Interface(
 
69
 
70
  # เริ่มการทำงานของ UI
71
  demo.launch()
72
+