Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -87,7 +87,7 @@ base_url_options=["https://lmzh.top/v1","https://api.openai.com/v1"]
|
|
87 |
model_options = ["gpt-3.5-turbo", "gpt-4o-mini", "gpt-4o", "gpt-4o-2024-08-06"]
|
88 |
|
89 |
def clear_output():
|
90 |
-
return "","",""
|
91 |
|
92 |
def validate_tran_api_key(api_key):
|
93 |
if api_key == '':
|
@@ -191,10 +191,10 @@ with app:
|
|
191 |
message_btn = gr.Button("发送", variant="primary", elem_classes="custom-button")
|
192 |
clear_btn = gr.Button("清除", variant="primary", elem_classes="custom-button")
|
193 |
with gr.Column():
|
194 |
-
output_textbox = gr.Textbox(label="显示问题答案", lines=
|
195 |
output_textbox2 = gr.Textbox(label="显示tokens数", lines=1, max_lines=1, elem_classes="custom-textbox",interactive=False,show_label=True)
|
196 |
message_btn.click(generate_response,inputs=[question,model_name,endpoint,transmit_api_key, official_api_key],outputs=output_textbox,show_progress=False)
|
197 |
-
clear_btn.click(clear_output,outputs=[question,output_textbox,output_textbox2],show_progress=False)
|
198 |
output_textbox.change(fn=calculate_cost_and_tokens,inputs=[output_textbox,model_name],outputs=output_textbox2,show_progress=False)
|
199 |
#添加页面底部
|
200 |
gr.HTML('''
|
|
|
87 |
model_options = ["gpt-3.5-turbo", "gpt-4o-mini", "gpt-4o", "gpt-4o-2024-08-06"]
|
88 |
|
89 |
def clear_output():
|
90 |
+
return "","","",""
|
91 |
|
92 |
def validate_tran_api_key(api_key):
|
93 |
if api_key == '':
|
|
|
191 |
message_btn = gr.Button("发送", variant="primary", elem_classes="custom-button")
|
192 |
clear_btn = gr.Button("清除", variant="primary", elem_classes="custom-button")
|
193 |
with gr.Column():
|
194 |
+
output_textbox = gr.Textbox(label="显示问题答案", lines=12, max_lines=12, elem_classes="custom-textbox",interactive=True,show_label=True,show_copy_button=True)
|
195 |
output_textbox2 = gr.Textbox(label="显示tokens数", lines=1, max_lines=1, elem_classes="custom-textbox",interactive=False,show_label=True)
|
196 |
message_btn.click(generate_response,inputs=[question,model_name,endpoint,transmit_api_key, official_api_key],outputs=output_textbox,show_progress=False)
|
197 |
+
clear_btn.click(clear_output,outputs=[question,output_textbox,output_textbox2,output_textbox2],show_progress=False)
|
198 |
output_textbox.change(fn=calculate_cost_and_tokens,inputs=[output_textbox,model_name],outputs=output_textbox2,show_progress=False)
|
199 |
#添加页面底部
|
200 |
gr.HTML('''
|