Spaces:
Runtime error
Runtime error
Commit ·
fd9ec39
1
Parent(s): dd0bfe6
fix load lang chain
Browse files
app.py
CHANGED
|
@@ -72,7 +72,10 @@ def infer(question, history):
|
|
| 72 |
|
| 73 |
chat_history = res
|
| 74 |
#print(chat_history)
|
| 75 |
-
query = question
|
|
|
|
|
|
|
|
|
|
| 76 |
result = qa({"question": query, "chat_history": chat_history})
|
| 77 |
#print(result)
|
| 78 |
return result["answer"]
|
|
@@ -108,7 +111,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 108 |
#pdf_doc = gr.File(label="Upload PDF", file_types=['.pdf'], type="file")
|
| 109 |
with gr.Row():
|
| 110 |
langchain_status = gr.Textbox(label="Status", placeholder="", interactive=False)
|
| 111 |
-
|
| 112 |
|
| 113 |
chatbot = gr.Chatbot([], elem_id="chatbot").style(height=350)
|
| 114 |
question = gr.Textbox(label="Question", placeholder="Type your question")
|
|
|
|
| 72 |
|
| 73 |
chat_history = res
|
| 74 |
#print(chat_history)
|
| 75 |
+
query = question + ". Please include response to the question in two languages in the following format \
|
| 76 |
+
English: \
|
| 77 |
+
Chinese (Simplified):"
|
| 78 |
+
|
| 79 |
result = qa({"question": query, "chat_history": chat_history})
|
| 80 |
#print(result)
|
| 81 |
return result["answer"]
|
|
|
|
| 111 |
#pdf_doc = gr.File(label="Upload PDF", file_types=['.pdf'], type="file")
|
| 112 |
with gr.Row():
|
| 113 |
langchain_status = gr.Textbox(label="Status", placeholder="", interactive=False)
|
| 114 |
+
load_pdf = gr.Button("Click to Load Langchain")
|
| 115 |
|
| 116 |
chatbot = gr.Chatbot([], elem_id="chatbot").style(height=350)
|
| 117 |
question = gr.Textbox(label="Question", placeholder="Type your question")
|