xu song
commited on
Commit
·
64e9b3c
1
Parent(s):
0064c50
update
Browse files- app_util.py +2 -2
- models/cpp_qwen2.py +0 -6
app_util.py
CHANGED
@@ -25,7 +25,7 @@ def generate_query(chatbot, history):
|
|
25 |
yield None, chatbot, history
|
26 |
else:
|
27 |
chatbot.append(None)
|
28 |
-
streamer = bot.
|
29 |
for query, query_tokens in streamer:
|
30 |
chatbot[-1] = (query, None)
|
31 |
yield query, chatbot, history
|
@@ -44,7 +44,7 @@ def generate_response(chatbot, history):
|
|
44 |
gr.Warning('You should generate or type user-input first.')
|
45 |
yield None, chatbot, history
|
46 |
else:
|
47 |
-
streamer = bot.
|
48 |
for response, response_tokens in streamer:
|
49 |
chatbot[-1] = (query, response)
|
50 |
yield response, chatbot, history
|
|
|
25 |
yield None, chatbot, history
|
26 |
else:
|
27 |
chatbot.append(None)
|
28 |
+
streamer = bot.generate(history, stream=True)
|
29 |
for query, query_tokens in streamer:
|
30 |
chatbot[-1] = (query, None)
|
31 |
yield query, chatbot, history
|
|
|
44 |
gr.Warning('You should generate or type user-input first.')
|
45 |
yield None, chatbot, history
|
46 |
else:
|
47 |
+
streamer = bot.generate(history, stream=True)
|
48 |
for response, response_tokens in streamer:
|
49 |
chatbot[-1] = (query, response)
|
50 |
yield response, chatbot, history
|
models/cpp_qwen2.py
CHANGED
@@ -121,12 +121,6 @@ class Qwen2Simulator(Simulator):
|
|
121 |
bot = Qwen2Simulator()
|
122 |
|
123 |
if __name__ == "__main__":
|
124 |
-
# messages = [
|
125 |
-
# {"role": "system", "content": "you are a helpful assistant"},
|
126 |
-
# {"role": "user", "content": "What is the capital of France?"}
|
127 |
-
# ]
|
128 |
-
# output = bot.generate_response(messages)
|
129 |
-
# print(output)
|
130 |
|
131 |
messages = [{"role": "system", "content": "你是一个导游。"}]
|
132 |
generated_tokens = None
|
|
|
121 |
bot = Qwen2Simulator()
|
122 |
|
123 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
messages = [{"role": "system", "content": "你是一个导游。"}]
|
126 |
generated_tokens = None
|