Spaces:
Runtime error
Runtime error
pedropauletti
commited on
Commit
·
8ee5801
1
Parent(s):
1a607bb
Update app.py
Browse files
app.py
CHANGED
@@ -45,22 +45,22 @@ def chatbot_response(chat_history, language):
|
|
45 |
global retriever
|
46 |
global last_answer
|
47 |
|
48 |
-
|
49 |
-
|
50 |
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
|
58 |
-
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
|
65 |
|
66 |
|
|
|
45 |
global retriever
|
46 |
global last_answer
|
47 |
|
48 |
+
|
49 |
+
chat_history[-1][1] = ""
|
50 |
|
51 |
|
52 |
+
if language == 'pt-br':
|
53 |
+
response = get_answers(retriever, GoogleTranslator(source='pt', target='en').translate(chat_history[0][0]))
|
54 |
+
response = GoogleTranslator(source='en', target='pt').translate(response)
|
55 |
+
else:
|
56 |
+
response = get_answers(retriever, chat_history[0][0])
|
57 |
|
58 |
+
last_answer = response
|
59 |
|
60 |
+
for character in response:
|
61 |
+
chat_history[-1][1] += character
|
62 |
+
time.sleep(0.01)
|
63 |
+
yield chat_history
|
64 |
|
65 |
|
66 |
|