Omnibus commited on
Commit
6d933ce
·
1 Parent(s): 0935784

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -100,7 +100,7 @@ def read_pdf(pdf_path):
100
  print (text)
101
  return text
102
 
103
-
104
  def read_pdf_online(url):
105
  uid=uuid.uuid4()
106
  print(f"reading {url}")
@@ -127,6 +127,7 @@ def read_pdf_online(url):
127
  return text
128
  else:
129
  text = response.status_code
 
130
  print(text)
131
  return text
132
 
@@ -149,6 +150,7 @@ def format_prompt(message, history):
149
  return prompt
150
 
151
 
 
152
  def run_gpt(
153
  prompt_template,
154
  stop_tokens,
@@ -315,7 +317,7 @@ def summarize(inp,history,data=None,files=None,url=None,pdf_url=None,pdf_batch=N
315
  #task = "complete?"
316
  history.clear()
317
  history.append((inp,rawp))
318
- yield "", history
319
 
320
  #################################
321
  def clear_fn():
@@ -345,10 +347,10 @@ with gr.Blocks() as app:
345
  pdf_url = gr.Textbox(label="PDF URL")
346
  with gr.Tab("PDF Batch"):
347
  pdf_batch = gr.Textbox(label="PDF Batch (comma separated)")
348
-
349
  #text=gr.JSON()
350
  #inp_query.change(search_models,inp_query,models_dd)
351
  clear_btn.click(clear_fn,None,[prompt,chatbot])
352
- go=button.click(summarize,[prompt,chatbot,data,file,url,pdf_url,pdf_batch],[prompt,chatbot])
353
  stop_button.click(None,None,None,cancels=[go])
354
  app.launch(server_port=7860,show_api=False)
 
100
  print (text)
101
  return text
102
 
103
+ error_box=[]
104
  def read_pdf_online(url):
105
  uid=uuid.uuid4()
106
  print(f"reading {url}")
 
127
  return text
128
  else:
129
  text = response.status_code
130
+ error_box.append(url)
131
  print(text)
132
  return text
133
 
 
150
  return prompt
151
 
152
 
153
+
154
  def run_gpt(
155
  prompt_template,
156
  stop_tokens,
 
317
  #task = "complete?"
318
  history.clear()
319
  history.append((inp,rawp))
320
+ yield "", history,error_box
321
 
322
  #################################
323
  def clear_fn():
 
347
  pdf_url = gr.Textbox(label="PDF URL")
348
  with gr.Tab("PDF Batch"):
349
  pdf_batch = gr.Textbox(label="PDF Batch (comma separated)")
350
+ e_box=gr.Textbox()
351
  #text=gr.JSON()
352
  #inp_query.change(search_models,inp_query,models_dd)
353
  clear_btn.click(clear_fn,None,[prompt,chatbot])
354
+ go=button.click(summarize,[prompt,chatbot,data,file,url,pdf_url,pdf_batch],[prompt,chatbot,e_box])
355
  stop_button.click(None,None,None,cancels=[go])
356
  app.launch(server_port=7860,show_api=False)