gugebing commited on
Commit
b91eff0
1 Parent(s): 0d7f4c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -24
app.py CHANGED
@@ -185,33 +185,32 @@ with gr.Blocks(css=my_css) as demo:
185
  gr.Button.update(value="你好,Bing。请随便写一首诗。", visible=True),
186
  gr.Button.update(value="你好,Bing。帮我搜索最近的新闻。", visible=True),
187
  )
188
- match len(QUESTION):
189
- case 0:
190
- return (history,
191
  gr.Button.update(visible=False), gr.Button.update(
192
  visible=False
193
  ), gr.Button.update(visible=False))
194
- case 1:
195
- return (
196
- history,
197
- gr.Button.update(value=QUESTION[0], visible=True),
198
- gr.Button.update(visible=False),
199
- gr.Button.update(visible=False),
200
- )
201
- case 2:
202
- return (
203
- history,
204
- gr.Button.upda1te(value=QUESTION[0], visible=True),
205
- gr.Button.update(value=QUESTION[1], visible=True),
206
- gr.Button.update(visible=False),
207
- )
208
- case _:
209
- return (
210
- history,
211
- gr.Button.update(value=QUESTION[0], visible=True),
212
- gr.Button.update(value=QUESTION[1], visible=True),
213
- gr.Button.update(value=QUESTION[2], visible=True),
214
- )
215
 
216
  # 快速选择时的事件
217
  question1.click(
 
185
  gr.Button.update(value="你好,Bing。请随便写一首诗。", visible=True),
186
  gr.Button.update(value="你好,Bing。帮我搜索最近的新闻。", visible=True),
187
  )
188
+ if len(QUESTION) == 0:
189
+ return (history,
 
190
  gr.Button.update(visible=False), gr.Button.update(
191
  visible=False
192
  ), gr.Button.update(visible=False))
193
+ elif len(QUESTION) == 1:
194
+ return (
195
+ history,
196
+ gr.Button.update(value=QUESTION[0], visible=True),
197
+ gr.Button.update(visible=False),
198
+ gr.Button.update(visible=False),
199
+ )
200
+ elif len(QUESTION) == 2:
201
+ return (
202
+ history,
203
+ gr.Button.upda1te(value=QUESTION[0], visible=True),
204
+ gr.Button.update(value=QUESTION[1], visible=True),
205
+ gr.Button.update(visible=False),
206
+ )
207
+ else:
208
+ return (
209
+ history,
210
+ gr.Button.update(value=QUESTION[0], visible=True),
211
+ gr.Button.update(value=QUESTION[1], visible=True),
212
+ gr.Button.update(value=QUESTION[2], visible=True),
213
+ )
214
 
215
  # 快速选择时的事件
216
  question1.click(