on1onmangoes commited on
Commit
b40b15f
1 Parent(s): de392ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -110,10 +110,10 @@ def format_relevant_documents(relevant_docs: list):
110
 
111
 
112
  # Function to handle PDF processing API call
113
- def process_pdf(pdf_file):
114
  return client.predict(
115
  pdf_file=handle_file(pdf_file),
116
- client_name="rosariarossi", # Hardcoded client name
117
  api_name="/process_pdf2"
118
  )[1] # Return only the result string
119
 
@@ -211,14 +211,26 @@ with gr.Blocks(css=CSS) as demo:
211
  ],
212
  )
213
 
 
 
 
 
 
 
 
 
 
 
 
214
  with gr.Tab("Process PDF"):
215
  pdf_input = gr.File(label="Upload PDF File")
 
216
  pdf_output = gr.Textbox(label="PDF Result", interactive=False)
217
-
218
  pdf_button = gr.Button("Process PDF")
219
  pdf_button.click(
220
  process_pdf,
221
- inputs=[pdf_input],
222
  outputs=pdf_output
223
  )
224
 
 
110
 
111
 
112
  # Function to handle PDF processing API call
113
+ def process_pdf(pdf_file, client_name):
114
  return client.predict(
115
  pdf_file=handle_file(pdf_file),
116
+ client_name=client_name, # Hardcoded client name
117
  api_name="/process_pdf2"
118
  )[1] # Return only the result string
119
 
 
211
  ],
212
  )
213
 
214
+ # with gr.Tab("Process PDF"):
215
+ # pdf_input = gr.File(label="Upload PDF File")
216
+ # pdf_output = gr.Textbox(label="PDF Result", interactive=False)
217
+
218
+ # pdf_button = gr.Button("Process PDF")
219
+ # pdf_button.click(
220
+ # process_pdf,
221
+ # inputs=[pdf_input],
222
+ # outputs=pdf_output
223
+ # )
224
+
225
  with gr.Tab("Process PDF"):
226
  pdf_input = gr.File(label="Upload PDF File")
227
+ select_client_dropdown = gr.Dropdown(['rosariarossi', 'bianchifiordaliso', 'lorenzoverdi'], value="rosariarossi", label="Select Client")
228
  pdf_output = gr.Textbox(label="PDF Result", interactive=False)
229
+
230
  pdf_button = gr.Button("Process PDF")
231
  pdf_button.click(
232
  process_pdf,
233
+ inputs=[pdf_input, select_client_dropdown], # Pass both PDF and client name as inputs
234
  outputs=pdf_output
235
  )
236