zxsipola123456 commited on
Commit
a7cfcbe
·
verified ·
1 Parent(s): 8790aa5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -21,12 +21,11 @@ def generate_response(question, model_name, endpoint, api_key):
21
  for chunk in response:
22
  if chunk.choices[0].delta.content is not None:
23
  result +=chunk.choices[0].delta.content
24
- # time.sleep(0.01)
25
  yield result
26
  except Exception as e:
27
  return f"响应生成失败: {str(e)}"
28
 
29
- base_url_options=["https://lmzh.top","https://api.openai.com"]
30
  model_options = ["gpt-3.5-turbo", "gpt-4o-mini", "gpt-4o"]
31
 
32
  def clear_output():
@@ -117,7 +116,7 @@ with app:
117
  with gr.Column():
118
  question=gr.Textbox(label="请输入你的问题: ",lines=2,max_lines=3)
119
  model_name=gr.Dropdown(label="选择模型", choices=model_options, value="gpt-3.5-turbo")
120
- endpoint=gr.Dropdown(label="选择官方或者接口地址", choices=base_url_options, value="https://lmzh.top")
121
  api_key=gr.Textbox(type='password', label='请输入中转或者官方api-key', placeholder='请在此填写您的API Key')
122
  with gr.Row(variant='panel'):
123
  message_btn = gr.Button("发送", variant="primary", elem_classes="custom-button")
 
21
  for chunk in response:
22
  if chunk.choices[0].delta.content is not None:
23
  result +=chunk.choices[0].delta.content
 
24
  yield result
25
  except Exception as e:
26
  return f"响应生成失败: {str(e)}"
27
 
28
+ base_url_options=["https://lmzh.top/v1","https://api.openai.com/v1"]
29
  model_options = ["gpt-3.5-turbo", "gpt-4o-mini", "gpt-4o"]
30
 
31
  def clear_output():
 
116
  with gr.Column():
117
  question=gr.Textbox(label="请输入你的问题: ",lines=2,max_lines=3)
118
  model_name=gr.Dropdown(label="选择模型", choices=model_options, value="gpt-3.5-turbo")
119
+ endpoint=gr.Dropdown(label="选择官方或者接口地址", choices=base_url_options, value="https://lmzh.top/v1")
120
  api_key=gr.Textbox(type='password', label='请输入中转或者官方api-key', placeholder='请在此填写您的API Key')
121
  with gr.Row(variant='panel'):
122
  message_btn = gr.Button("发送", variant="primary", elem_classes="custom-button")