Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -112,7 +112,7 @@ def respond(message,
|
|
112 |
print("An error occurred:", error)
|
113 |
print("en_message exception occurred")
|
114 |
|
115 |
-
|
116 |
print("added last question\n")
|
117 |
print(time.time())
|
118 |
|
@@ -126,13 +126,14 @@ def respond(message,
|
|
126 |
top_p=top_p,
|
127 |
):
|
128 |
try:
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
|
|
136 |
except Exception as error:
|
137 |
print("An error occurred:", error)
|
138 |
yield ""
|
|
|
112 |
print("An error occurred:", error)
|
113 |
print("en_message exception occurred")
|
114 |
|
115 |
+
print(messages)
|
116 |
print("added last question\n")
|
117 |
print(time.time())
|
118 |
|
|
|
126 |
top_p=top_p,
|
127 |
):
|
128 |
try:
|
129 |
+
if len(message.choices)>0:
|
130 |
+
token = message.choices[0].delta.content
|
131 |
+
response += token
|
132 |
+
if(len(response)>0):
|
133 |
+
translated = translator.translate(response, src='en', dest=message_language)
|
134 |
+
if not (translated is None):
|
135 |
+
translated_response = translated.text
|
136 |
+
yield translated_response
|
137 |
except Exception as error:
|
138 |
print("An error occurred:", error)
|
139 |
yield ""
|