Omnibus commited on
Commit
826286f
·
1 Parent(s): e37b210

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -4
app.py CHANGED
@@ -243,12 +243,28 @@ def compress_data(c, instruct, history):
243
 
244
 
245
 
246
- def summarize(inp,history,data=None,files=None,url=None,pdf_url=None):
247
  if inp == "":
248
  inp = "Process this data"
249
  history.clear()
250
  history = [(inp,"Working on it...")]
251
  yield "",history
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  if pdf_url.startswith("http"):
253
  print("PDF_URL")
254
  out = read_pdf_online(pdf_url)
@@ -319,13 +335,16 @@ with gr.Blocks() as app:
319
  data=gr.Textbox(label="Input Data (paste text)", lines=6)
320
  with gr.Tab("File"):
321
  file=gr.Files(label="Input File (.pdf .txt)")
322
- with gr.Tab("URL"):
323
  url = gr.Textbox(label="URL")
324
  with gr.Tab("PDF URL"):
325
- pdf_url = gr.Textbox(label="PDF URL")
 
 
 
326
  #text=gr.JSON()
327
  #inp_query.change(search_models,inp_query,models_dd)
328
  clear_btn.click(clear_fn,None,[prompt,chatbot])
329
- go=button.click(summarize,[prompt,chatbot,data,file,url,pdf_url],[prompt,chatbot])
330
  stop_button.click(None,None,None,cancels=[go])
331
  app.launch(server_port=7860,show_api=False)
 
243
 
244
 
245
 
246
+ def summarize(inp,history,data=None,files=None,url=None,pdf_url=None,pdf_batch=None):
247
  if inp == "":
248
  inp = "Process this data"
249
  history.clear()
250
  history = [(inp,"Working on it...")]
251
  yield "",history
252
+
253
+ if pdf_batch.startswith("http"):
254
+ c=0
255
+ data=""
256
+ for i in str(pdf_batch):
257
+ if i==",":
258
+ c+=1
259
+ try:
260
+ for i in range(c):
261
+ batch_url = pdf_batch.split(",",c)[i]
262
+ bb = read_pdf_online(batch_url)
263
+ data=f'{data}\nFile Name URL ({batch_url}):\n{bb}'
264
+
265
+ print (f'c:: {c}')
266
+
267
+
268
  if pdf_url.startswith("http"):
269
  print("PDF_URL")
270
  out = read_pdf_online(pdf_url)
 
335
  data=gr.Textbox(label="Input Data (paste text)", lines=6)
336
  with gr.Tab("File"):
337
  file=gr.Files(label="Input File (.pdf .txt)")
338
+ with gr.Tab("Raw HTML"):
339
  url = gr.Textbox(label="URL")
340
  with gr.Tab("PDF URL"):
341
+ pdf_url = gr.Textbox(label="PDF URL")
342
+ with gr.Tab("PDF Batch"):
343
+ pdf_batch = gr.Textbox(label="PDF Batch (comma separated)")
344
+
345
  #text=gr.JSON()
346
  #inp_query.change(search_models,inp_query,models_dd)
347
  clear_btn.click(clear_fn,None,[prompt,chatbot])
348
+ go=button.click(summarize,[prompt,chatbot,data,file,url,pdf_url,pdf_batch],[prompt,chatbot])
349
  stop_button.click(None,None,None,cancels=[go])
350
  app.launch(server_port=7860,show_api=False)