srijaydeshpande commited on
Commit
01b2722
·
verified ·
1 Parent(s): 46f29d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -182,6 +182,8 @@ def deidentify_doc(pdftext, maxtokens, temperature, top_probability):
182
  def pdf_to_text(files, maxtokens=2048, temperature=0, top_probability=0.95):
183
  files=[files]#remove later
184
  for file in files:
 
 
185
  file_name = os.path.basename(file)
186
  file_name_splt = file_name.split('.')
187
  # print('File name is ', file_name)
@@ -193,7 +195,7 @@ def pdf_to_text(files, maxtokens=2048, temperature=0, top_probability=0.95):
193
  if (pdftext): #shift this if block to right later
194
  anonymized_text = deidentify_doc(pdftext, maxtokens, temperature, top_probability)
195
  else:
196
- anonymized_text = 'Please provide a valid PDF. Either no file is attached, or the file appears to be corrupted.'
197
  return anonymized_text
198
 
199
  # model_id = "models/Meta-Llama-3-70B-Instruct-Q3_K_M.gguf"
 
182
  def pdf_to_text(files, maxtokens=2048, temperature=0, top_probability=0.95):
183
  files=[files]#remove later
184
  for file in files:
185
+ if not file:
186
+ return 'Please provide a valid PDF'
187
  file_name = os.path.basename(file)
188
  file_name_splt = file_name.split('.')
189
  # print('File name is ', file_name)
 
195
  if (pdftext): #shift this if block to right later
196
  anonymized_text = deidentify_doc(pdftext, maxtokens, temperature, top_probability)
197
  else:
198
+ anonymized_text = 'PDF file appears to be corrupted.'
199
  return anonymized_text
200
 
201
  # model_id = "models/Meta-Llama-3-70B-Instruct-Q3_K_M.gguf"