Nattapong Tapachoom commited on
Commit
c2c2eb4
·
1 Parent(s): 0fdde14

Fix example creation order in Gradio block to ensure text_input is defined first

Browse files
Files changed (1) hide show
  1. app.py +11 -10
app.py CHANGED
@@ -145,16 +145,17 @@ with gr.Blocks(
145
  <h3 style='color:#4a4a7d; margin-bottom:10px;'>� ตัวอย่างข้อความ</h3>
146
  </div>
147
  """)
148
- examples = gr.Examples(
149
- examples=[
150
- ["วันนี้อากาศดีมาก ฉันรู้สึกมีความสุขมาก"],
151
- ["ฉันไม่ชอบอาหารนี้ รสชาติแปลกมาก"],
152
- ["วันนี้เป็นยังไง\nเรียนหนังสือกันไหม"],
153
- ["บริการดีมาก พนักงานใจดี\nแต่ของมีราคาแพงไปหน่อย\nโดยรวมแล้วพอใจ"]
154
- ],
155
- inputs=[text_input],
156
- label="คลิกเพื่อใส่ตัวอย่างในกล่องข้อความ"
157
- )
 
158
  with gr.Column():
159
  gr.Markdown("""
160
  <div class='main-card'>
 
145
  <h3 style='color:#4a4a7d; margin-bottom:10px;'>� ตัวอย่างข้อความ</h3>
146
  </div>
147
  """)
148
+ # ต้องสร้างตัวอย่างหลัง text_input ถูกนิยามแล้ว
149
+ examples = gr.Examples(
150
+ examples=[
151
+ ["วันนี้อากาศดีมาก ฉันรู้สึกมีความสุขมาก"],
152
+ ["ฉันไม่ชอบอาหารนี้ รสชาติแปลกมาก"],
153
+ ["วันนี้เป็นยังไง\nเรียนหนังสือกันไหม"],
154
+ ["บริการดีมาก พนักงานใจดี\nแต่ของมีราคาแพงไปหน่อย\nโดยรวมแล้วพอใจ"]
155
+ ],
156
+ inputs=[text_input],
157
+ label="คลิกเพื่อใส่ตัวอย่างในกล่องข้อความ"
158
+ )
159
  with gr.Column():
160
  gr.Markdown("""
161
  <div class='main-card'>