nuojohnchen commited on
Commit
5a674b6
·
verified ·
1 Parent(s): 994b096

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -336,19 +336,23 @@ with gr.Blocks(fill_height=True, css=css) as demo:
336
  auto_examples = [
337
  ["Write a short poem about artificial intelligence",
338
  "Qwen/Qwen2.5-7B-Instruct",
339
- "Qwen/Qwen2.5-7B-Instruct",
340
- "01-ai/Yi-6B-Chat",
341
  "01-ai/Yi-6B-Chat"],
342
  ["我听说有些人有高血压却没有任何症状。这是真的吗?",
343
  "FreedomIntelligence/Apollo-7B",
344
- "FreedomIntelligence/Apollo-7B",
345
- "openchat/openchat-3.5-0106",
346
  "openchat/openchat-3.5-0106"]
347
  ]
348
 
 
 
 
 
 
 
349
  gr.Examples(
350
  examples=auto_examples,
351
- inputs=[auto_instruction, model_dropdown_1, custom_model_1, model_dropdown_2, custom_model_2]
 
 
352
  )
353
 
354
  # Manual Evaluation tab (now second)
 
336
  auto_examples = [
337
  ["Write a short poem about artificial intelligence",
338
  "Qwen/Qwen2.5-7B-Instruct",
 
 
339
  "01-ai/Yi-6B-Chat"],
340
  ["我听说有些人有高血压却没有任何症状。这是真的吗?",
341
  "FreedomIntelligence/Apollo-7B",
 
 
342
  "openchat/openchat-3.5-0106"]
343
  ]
344
 
345
+ # 创建一个函数来处理示例点击
346
+ def process_example(instruction, model1, model2):
347
+ """处理示例点击,将模型名称填入下拉菜单,清空自定义输入框"""
348
+ return instruction, model1, model1, model2, model2
349
+
350
+ # 使用gr.Examples的处理函数
351
  gr.Examples(
352
  examples=auto_examples,
353
+ inputs=[auto_instruction, model_dropdown_1, model_dropdown_2],
354
+ fn=process_example,
355
+ outputs=[auto_instruction, model_dropdown_1, custom_model_1, model_dropdown_2, custom_model_2]
356
  )
357
 
358
  # Manual Evaluation tab (now second)