Omnibus commited on
Commit
1be80ae
1 Parent(s): 5d76b47

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -103,6 +103,7 @@ def read_pdf(pdf_path):
103
 
104
  def read_pdf_online(url):
105
  uid=uuid.uuid4()
 
106
  response = requests.get(url, stream=True)
107
  text=""
108
  if response.status_code == 200:
@@ -237,6 +238,7 @@ def summarize(inp,history,data=None,file=None,url=None,pdf_url=None):
237
  history = [(inp,"Working on it...")]
238
  yield "",history
239
  if pdf_url.startswith("http"):
 
240
  out = read_pdf_online(pdf_url)
241
  data=out
242
  if url.startswith("http"):
@@ -260,7 +262,7 @@ def summarize(inp,history,data=None,file=None,url=None,pdf_url=None):
260
  except Exception as e:
261
  data = "Error"
262
  print (e)
263
- if not data == "Error":
264
  print(inp)
265
  out = str(data)
266
  rl = len(out)
@@ -273,7 +275,7 @@ def summarize(inp,history,data=None,file=None,url=None,pdf_url=None):
273
 
274
  rawp = compress_data(c,inp,out)
275
  else:
276
- rawp = "Error"
277
  #print (rawp)
278
  #print (f'out:: {out}')
279
  #history += "observation: the search results are:\n {}\n".format(out)
 
103
 
104
  def read_pdf_online(url):
105
  uid=uuid.uuid4()
106
+ print(f"reading {url}")
107
  response = requests.get(url, stream=True)
108
  text=""
109
  if response.status_code == 200:
 
238
  history = [(inp,"Working on it...")]
239
  yield "",history
240
  if pdf_url.startswith("http"):
241
+ print("PDF_URL")
242
  out = read_pdf_online(pdf_url)
243
  data=out
244
  if url.startswith("http"):
 
262
  except Exception as e:
263
  data = "Error"
264
  print (e)
265
+ if data != "Error" and data != "":
266
  print(inp)
267
  out = str(data)
268
  rl = len(out)
 
275
 
276
  rawp = compress_data(c,inp,out)
277
  else:
278
+ rawp = "Provide a valid data source"
279
  #print (rawp)
280
  #print (f'out:: {out}')
281
  #history += "observation: the search results are:\n {}\n".format(out)