Spaces:
Running
Running
kenghuoxiong
commited on
Commit
•
4292e9c
1
Parent(s):
6f52ead
Update app.py
Browse files
app.py
CHANGED
@@ -57,7 +57,6 @@ def qwen_api(user_message, top_p=0.9,temperature=0.7, system_message='', max_tok
|
|
57 |
):
|
58 |
token = message.choices[0].delta.content
|
59 |
response += token
|
60 |
-
yield response
|
61 |
return response
|
62 |
|
63 |
os.environ["OPENAI_API_BASE"] = "https://api-inference.huggingface.co/v1/"
|
@@ -93,6 +92,8 @@ def chat(question, history):
|
|
93 |
response = qa.invoke(question)['result']
|
94 |
else:
|
95 |
response = qwen_api(question, gradio_history=history)
|
|
|
|
|
96 |
return response
|
97 |
|
98 |
|
@@ -133,7 +134,7 @@ def respond(
|
|
133 |
chatbot = gr.Chatbot(height=600)
|
134 |
|
135 |
demo = gr.ChatInterface(
|
136 |
-
chat,
|
137 |
fill_height=True,
|
138 |
chatbot=chatbot,
|
139 |
additional_inputs=[
|
|
|
57 |
):
|
58 |
token = message.choices[0].delta.content
|
59 |
response += token
|
|
|
60 |
return response
|
61 |
|
62 |
os.environ["OPENAI_API_BASE"] = "https://api-inference.huggingface.co/v1/"
|
|
|
92 |
response = qa.invoke(question)['result']
|
93 |
else:
|
94 |
response = qwen_api(question, gradio_history=history)
|
95 |
+
print(response)
|
96 |
+
yield response
|
97 |
return response
|
98 |
|
99 |
|
|
|
134 |
chatbot = gr.Chatbot(height=600)
|
135 |
|
136 |
demo = gr.ChatInterface(
|
137 |
+
fn=chat,
|
138 |
fill_height=True,
|
139 |
chatbot=chatbot,
|
140 |
additional_inputs=[
|