Update app.py
Browse files
app.py
CHANGED
|
@@ -43,8 +43,12 @@ def add_text(history, text):
|
|
| 43 |
|
| 44 |
def bot(history):
|
| 45 |
response = infer(history[-1][0], history)
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
def infer(question, history):
|
| 50 |
|
|
@@ -58,7 +62,7 @@ def infer(question, history):
|
|
| 58 |
query = question
|
| 59 |
result = qa({"question": query, "chat_history": chat_history})
|
| 60 |
#print(result)
|
| 61 |
-
|
| 62 |
|
| 63 |
css="""
|
| 64 |
#col-container {max-width: 700px; margin-left: auto; margin-right: auto;}
|
|
|
|
| 43 |
|
| 44 |
def bot(history):
|
| 45 |
response = infer(history[-1][0], history)
|
| 46 |
+
|
| 47 |
+
for character in response:
|
| 48 |
+
history[-1][1] += character
|
| 49 |
+
time.sleep(0.05)
|
| 50 |
+
yield history
|
| 51 |
+
|
| 52 |
|
| 53 |
def infer(question, history):
|
| 54 |
|
|
|
|
| 62 |
query = question
|
| 63 |
result = qa({"question": query, "chat_history": chat_history})
|
| 64 |
#print(result)
|
| 65 |
+
return result["answer"]
|
| 66 |
|
| 67 |
css="""
|
| 68 |
#col-container {max-width: 700px; margin-left: auto; margin-right: auto;}
|