Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,11 +43,19 @@ def pdf_changes(pdf_doc):
|
|
| 43 |
)
|
| 44 |
return "Ready"
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
def query(history, text):
|
| 47 |
-
|
| 48 |
-
|
|
|
|
| 49 |
|
| 50 |
-
return
|
| 51 |
|
| 52 |
css="""
|
| 53 |
#col-container {max-width: 700px; margin-left: auto; margin-right: auto;}
|
|
|
|
| 43 |
)
|
| 44 |
return "Ready"
|
| 45 |
|
| 46 |
+
def format(query, history):
|
| 47 |
+
fhistory = []
|
| 48 |
+
for user, bot in history:
|
| 49 |
+
fhistory.append(f"User: {user}")
|
| 50 |
+
fhistory.append(f"Assistant: {bot}")
|
| 51 |
+
return fhistory
|
| 52 |
+
|
| 53 |
def query(history, text):
|
| 54 |
+
fhistory = format(text,history)
|
| 55 |
+
result = qa({'question': text, 'chat_history': fhistory})
|
| 56 |
+
new_history = history + [(text,result['answer'])]
|
| 57 |
|
| 58 |
+
return new_history,""
|
| 59 |
|
| 60 |
css="""
|
| 61 |
#col-container {max-width: 700px; margin-left: auto; margin-right: auto;}
|