Pijush2023 commited on
Commit
e0a04c7
·
verified ·
1 Parent(s): 1d36ddd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -229,6 +229,15 @@ with gr.Blocks() as demo:
229
  output_textbox = gr.Textbox(label="Result")
230
  process_button = gr.Button("Process PDF and Upload")
231
  process_button.click(fn=process_pdf, inputs=[file_input, gr.State([])], outputs=[document_table, output_textbox])
232
-
 
 
 
 
 
 
 
 
 
233
 
234
  demo.launch(show_error=True)
 
229
  output_textbox = gr.Textbox(label="Result")
230
  process_button = gr.Button("Process PDF and Upload")
231
  process_button.click(fn=process_pdf, inputs=[file_input, gr.State([])], outputs=[document_table, output_textbox])
232
+
233
+
234
+ # When the process button is clicked, dynamically initialize Pinecone with API key and index name
235
+ def process_with_dynamic_pinecone(pdf_file, uploaded_documents, pinecone_index_name, pinecone_api_key):
236
+ vectorstore = init_pinecone(pinecone_api_key, pinecone_index_name)
237
+ return process_pdf(pdf_file, uploaded_documents, vectorstore)
238
+
239
+ process_button.click(fn=process_with_dynamic_pinecone,
240
+ inputs=[file_input, gr.State([]), pinecone_index_input, pinecone_api_key_input],
241
+ outputs=[document_table, output_textbox])
242
 
243
  demo.launch(show_error=True)