Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,9 +10,6 @@ from langchain.chains import RetrievalQA # for conversing with chatGPT
|
|
10 |
from langchain.chat_models import ChatOpenAI # the LLM model we'll use (ChatGPT)
|
11 |
|
12 |
|
13 |
-
def loading_pdf():
|
14 |
-
return "Loading..."
|
15 |
-
|
16 |
def load_pdf(pdf_doc, open_ai_key):
|
17 |
if openai_key is not None:
|
18 |
os.environ['OPENAI_API_KEY'] = open_ai_key
|
@@ -58,14 +55,11 @@ with gr.Blocks(css=css,theme=gr.themes.Monochrome()) as demo:
|
|
58 |
chatbot = gr.Chatbot([], elem_id="chatbot").style(height=350)
|
59 |
question = gr.Textbox(label="Question", placeholder="Type your question and hit Enter ")
|
60 |
submit_btn = gr.Button("Send Message")
|
61 |
-
|
62 |
load_pdf.click(load_pdf, inputs=[pdf_doc, openai_key], outputs=[langchain_status], queue=False)
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
)
|
67 |
-
submit_btn.click(answer_query, [chatbot,question], [chatbot, question]).then(
|
68 |
-
bot, chatbot, chatbot)
|
69 |
|
70 |
|
71 |
demo.launch()
|
|
|
10 |
from langchain.chat_models import ChatOpenAI # the LLM model we'll use (ChatGPT)
|
11 |
|
12 |
|
|
|
|
|
|
|
13 |
def load_pdf(pdf_doc, open_ai_key):
|
14 |
if openai_key is not None:
|
15 |
os.environ['OPENAI_API_KEY'] = open_ai_key
|
|
|
55 |
chatbot = gr.Chatbot([], elem_id="chatbot").style(height=350)
|
56 |
question = gr.Textbox(label="Question", placeholder="Type your question and hit Enter ")
|
57 |
submit_btn = gr.Button("Send Message")
|
58 |
+
|
59 |
load_pdf.click(load_pdf, inputs=[pdf_doc, openai_key], outputs=[langchain_status], queue=False)
|
60 |
|
61 |
+
submit_btn.click(answer_query,question,chatbot)
|
62 |
+
|
|
|
|
|
|
|
63 |
|
64 |
|
65 |
demo.launch()
|