zxsipola123456 commited on
Commit
de8bdee
·
verified ·
1 Parent(s): 08cc020

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -13,11 +13,11 @@ def generate_response(question, model_name, endpoint, api_key):
13
  response = client.chat.completions.create(
14
  model=model_name,
15
  messages=messages,
16
- max_tokens=100,
17
  temperature=0.1,
18
  stream=True,
19
  )
20
- result=‘’
21
  for chunk in response:
22
  if chunk.choices[0].delta.content is not None:
23
  result +=chunk.choices[0].delta.content
@@ -135,8 +135,8 @@ with app:
135
  clear_btn = gr.Button("清除", variant="primary", elem_classes="custom-button")
136
  with gr.Column():
137
  output_textbox = gr.Textbox(label="显示问题答案", lines=15, max_lines=200, elem_classes="custom-textbox",interactive=True,show_label=True,show_copy_button=True)
138
- message_btn.click(generate_response,inputs=[question,model_name,endpoint,api_key],outputs=output_textbox)
139
- clear_btn.click(clear_output,outputs=[question,output_textbox])
140
  #添加页面底部
141
  gr.HTML('''
142
  <div class="footer">
 
13
  response = client.chat.completions.create(
14
  model=model_name,
15
  messages=messages,
16
+ max_tokens=1000,
17
  temperature=0.1,
18
  stream=True,
19
  )
20
+ result=""
21
  for chunk in response:
22
  if chunk.choices[0].delta.content is not None:
23
  result +=chunk.choices[0].delta.content
 
135
  clear_btn = gr.Button("清除", variant="primary", elem_classes="custom-button")
136
  with gr.Column():
137
  output_textbox = gr.Textbox(label="显示问题答案", lines=15, max_lines=200, elem_classes="custom-textbox",interactive=True,show_label=True,show_copy_button=True)
138
+ message_btn.click(generate_response,inputs=[question,model_name,endpoint,api_key],outputs=output_textbox,show_progress=False)
139
+ clear_btn.click(clear_output,outputs=[question,output_textbox],show_progress=False)
140
  #添加页面底部
141
  gr.HTML('''
142
  <div class="footer">