fffiloni commited on
Commit
3404f46
1 Parent(s): 89a7ab3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -14,7 +14,8 @@ embeddings = HuggingFaceHubEmbeddings()
14
  from langchain.vectorstores import Chroma
15
 
16
  from langchain.chains import RetrievalQA
17
-
 
18
  def pdf_changes(pdf_doc):
19
  loader = OnlinePDFLoader(pdf_doc.name)
20
  documents = loader.load()
@@ -61,13 +62,13 @@ with gr.Blocks(css=css) as demo:
61
  with gr.Column():
62
  pdf_doc = gr.File(label="Load a pdf", file_types=['.pdf'], type="file")
63
  with gr.Row():
64
- langchain_status = gr.Textbox(label=None, placeholder="Status", interactive=False)
65
  load_pdf = gr.Button("Load pdf to langchain")
66
 
67
  chatbot = gr.Chatbot([], elem_id="chatbot").style(height=350)
68
  with gr.Row():
69
  question = gr.Textbox(lable=None, placeholder="Type your question and hit Enter ")
70
-
71
  load_pdf.click(pdf_changes, pdf_doc, langchain_status, queue=False)
72
  question.submit(add_text, [chatbot, question], [chatbot, question]).then(
73
  bot, chatbot, chatbot
 
14
  from langchain.vectorstores import Chroma
15
 
16
  from langchain.chains import RetrievalQA
17
+ def loading_pdf():
18
+ return "Loading..."
19
  def pdf_changes(pdf_doc):
20
  loader = OnlinePDFLoader(pdf_doc.name)
21
  documents = loader.load()
 
62
  with gr.Column():
63
  pdf_doc = gr.File(label="Load a pdf", file_types=['.pdf'], type="file")
64
  with gr.Row():
65
+ langchain_status = gr.Textbox(label="Status", placeholder="", interactive=False)
66
  load_pdf = gr.Button("Load pdf to langchain")
67
 
68
  chatbot = gr.Chatbot([], elem_id="chatbot").style(height=350)
69
  with gr.Row():
70
  question = gr.Textbox(lable=None, placeholder="Type your question and hit Enter ")
71
+ load_pdf.click(loading_pdf, None, langchain_status, queue=False)
72
  load_pdf.click(pdf_changes, pdf_doc, langchain_status, queue=False)
73
  question.submit(add_text, [chatbot, question], [chatbot, question]).then(
74
  bot, chatbot, chatbot