Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -139,9 +139,8 @@ def response(state:AppState = AppState()):
|
|
139 |
messages.append({"role": "user", "content": [{"type": "text", "text": txt}, {"type": "image"}]})
|
140 |
else: # regular input
|
141 |
messages.append({"role": "user", "content": [{"type": "text", "text": txt}]})
|
142 |
-
|
143 |
try:
|
144 |
-
token = ""
|
145 |
for message in client.chat_completion(
|
146 |
messages,
|
147 |
max_tokens=max_new_tokens,
|
@@ -154,13 +153,13 @@ def response(state:AppState = AppState()):
|
|
154 |
except:
|
155 |
print("Chưa lấy được thông tin dịch")
|
156 |
if state.message["files"] != "":
|
157 |
-
state.history.append([(txt,state.image["file"]),
|
158 |
state.conversation.append({"role":"user","content":"Bạn: " + str(txt) + str(state.image["file"])})
|
159 |
-
state.conversation.append({"role":"assistant", "content": "Bot: " + str(
|
160 |
else:
|
161 |
-
state.history.append([txt,
|
162 |
state.conversation.append({"role": "user", "content":"Bạn: " + str(txt)})
|
163 |
-
state.conversation.append({"role": "assistant", "content":"Bot: " + str(
|
164 |
else:
|
165 |
textout = "Tôi không nghe rõ"
|
166 |
|
|
|
139 |
messages.append({"role": "user", "content": [{"type": "text", "text": txt}, {"type": "image"}]})
|
140 |
else: # regular input
|
141 |
messages.append({"role": "user", "content": [{"type": "text", "text": txt}]})
|
142 |
+
token = ""
|
143 |
try:
|
|
|
144 |
for message in client.chat_completion(
|
145 |
messages,
|
146 |
max_tokens=max_new_tokens,
|
|
|
153 |
except:
|
154 |
print("Chưa lấy được thông tin dịch")
|
155 |
if state.message["files"] != "":
|
156 |
+
state.history.append([(txt,state.image["file"]),textout)
|
157 |
state.conversation.append({"role":"user","content":"Bạn: " + str(txt) + str(state.image["file"])})
|
158 |
+
state.conversation.append({"role":"assistant", "content": "Bot: " + str(textout)})
|
159 |
else:
|
160 |
+
state.history.append([txt,textout])
|
161 |
state.conversation.append({"role": "user", "content":"Bạn: " + str(txt)})
|
162 |
+
state.conversation.append({"role": "assistant", "content":"Bot: " + str(textout)})
|
163 |
else:
|
164 |
textout = "Tôi không nghe rõ"
|
165 |
|