senthil3226w commited on
Commit
87671fd
·
verified ·
1 Parent(s): 9dd3974

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -82,19 +82,19 @@ def query_documents(user_query):
82
 
83
  return response
84
 
85
- # Gradio interface to upload PDFs
86
- pdf_input = gr.inputs.File(file_count="multiple", label="Upload up to 10 PDF files")
87
- query_input = gr.inputs.Textbox(label="Enter your query", placeholder="Type a question here...")
88
-
89
- # Gradio output
90
- output = gr.outputs.Textbox()
91
 
92
  # Gradio interface combining document upload and query features
93
- gr.Interface(
94
- fn=[process_documents, query_documents],
95
- inputs=[pdf_input, query_input],
96
- outputs=[output, output],
97
- title="PDF Document Embedding and Query",
98
- description="Upload PDF files to embed them and then query to retrieve relevant documents.",
99
- live=True
100
- ).launch()
 
 
 
 
 
 
 
82
 
83
  return response
84
 
 
 
 
 
 
 
85
 
86
  # Gradio interface combining document upload and query features
87
+ with gr.Blocks() as demo:
88
+ pdf_input = gr.File(file_count="multiple", label="Upload up to 10 PDF files")
89
+ query_input = gr.Textbox(label="Enter your query", placeholder="Type a question here...")
90
+
91
+ process_btn = gr.Button("Process PDFs")
92
+ query_btn = gr.Button("Query Documents")
93
+
94
+ process_output = gr.Textbox()
95
+ query_output = gr.Textbox()
96
+
97
+ process_btn.click(process_documents, inputs=[pdf_input], outputs=[process_output])
98
+ query_btn.click(query_documents, inputs=[query_input], outputs=[query_output])
99
+
100
+ demo.launch()