雷娃 commited on
Commit
81390b6
·
1 Parent(s): 37ff5ad

add interactive mode

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -15,7 +15,7 @@ model = AutoModelForCausalLM.from_pretrained(
15
  ).eval()
16
 
17
  # define chat function
18
- def chat(user_input, max_new_tokens=512):
19
  # chat history
20
  messages = [
21
  {"role": "system", "content": "You are Ling, an assistant created by inclusionAI"},
@@ -47,10 +47,13 @@ def chat(user_input, max_new_tokens=512):
47
  interface = gr.Interface(
48
  fn=chat,
49
  inputs=[
50
- gr.Textbox(lines=5, label="输入你的问题"),
51
  gr.Slider(minimum=100, maximum=1024, step=50, label="生成长度")
52
  ],
53
- outputs=gr.Textbox(label="模型回复"),
 
 
 
54
  title="Ling-lite-1.5 MoE 模型 Demo",
55
  description="基于 [inclusionAI/Ling-lite-1.5](https://huggingface.co/inclusionAI/Ling-lite-1.5) 的对话式文本生成演示。",
56
  examples=[
 
15
  ).eval()
16
 
17
  # define chat function
18
+ def chat(user_input, max_new_tokens=10240):
19
  # chat history
20
  messages = [
21
  {"role": "system", "content": "You are Ling, an assistant created by inclusionAI"},
 
47
  interface = gr.Interface(
48
  fn=chat,
49
  inputs=[
50
+ gr.Textbox(lines=8, label="输入你的问题"),
51
  gr.Slider(minimum=100, maximum=1024, step=50, label="生成长度")
52
  ],
53
+ outputs=[
54
+ gr.Textbox(lines=8, label="模型回复"),
55
+ gr.Textbox(label="耗时", interactive=False)
56
+ ],
57
  title="Ling-lite-1.5 MoE 模型 Demo",
58
  description="基于 [inclusionAI/Ling-lite-1.5](https://huggingface.co/inclusionAI/Ling-lite-1.5) 的对话式文本生成演示。",
59
  examples=[