Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -34,12 +34,10 @@ def pdf_changes(pdf_doc, open_ai_key):
|
|
34 |
return "Please provide an OpenAI API key"
|
35 |
|
36 |
|
37 |
-
def
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
return result["answer"]
|
42 |
-
|
43 |
css="""
|
44 |
#col-container {max-width: 700px; margin-left: auto; margin-right: auto;}
|
45 |
"""
|
@@ -68,12 +66,10 @@ with gr.Blocks(css=css) as demo:
|
|
68 |
chatbot = gr.Chatbot([], elem_id="chatbot").style(height=350)
|
69 |
question = gr.Textbox(label="Question", placeholder="Type your question and hit Enter ")
|
70 |
submit_btn = gr.Button("Send Message")
|
|
|
71 |
load_pdf.click(loading_pdf, None, langchain_status, queue=False)
|
72 |
load_pdf.click(pdf_changes, inputs=[pdf_doc, openai_key], outputs=[langchain_status], queue=False)
|
73 |
-
|
74 |
-
|
75 |
-
)
|
76 |
-
submit_btn.click( [chatbot, question], [chatbot, question]).then(
|
77 |
-
bot, chatbot, chatbot)
|
78 |
|
79 |
demo.launch()
|
|
|
34 |
return "Please provide an OpenAI API key"
|
35 |
|
36 |
|
37 |
+
def answer_query(query):
|
38 |
+
question = query
|
39 |
+
return pdf_qa.run(question)
|
40 |
+
|
|
|
|
|
41 |
css="""
|
42 |
#col-container {max-width: 700px; margin-left: auto; margin-right: auto;}
|
43 |
"""
|
|
|
66 |
chatbot = gr.Chatbot([], elem_id="chatbot").style(height=350)
|
67 |
question = gr.Textbox(label="Question", placeholder="Type your question and hit Enter ")
|
68 |
submit_btn = gr.Button("Send Message")
|
69 |
+
|
70 |
load_pdf.click(loading_pdf, None, langchain_status, queue=False)
|
71 |
load_pdf.click(pdf_changes, inputs=[pdf_doc, openai_key], outputs=[langchain_status], queue=False)
|
72 |
+
submit_query.click(answer_query,inputs,ouputs)
|
73 |
+
|
|
|
|
|
|
|
74 |
|
75 |
demo.launch()
|