Commit ·
40a9d80
1
Parent(s): 2bac082
Update app.py
Browse files
app.py
CHANGED
|
@@ -192,6 +192,8 @@ def pdf_to_text(files, maxtokens=2048, temperature=0, top_probability=0.95):
|
|
| 192 |
# pdftext = file # remove later
|
| 193 |
if (pdftext): #shift this if block to right later
|
| 194 |
anonymized_text = deidentify_doc(pdftext, maxtokens, temperature, top_probability)
|
|
|
|
|
|
|
| 195 |
return anonymized_text
|
| 196 |
|
| 197 |
# model_id = "models/Meta-Llama-3-70B-Instruct-Q3_K_M.gguf"
|
|
@@ -207,7 +209,7 @@ output_text = gr.Textbox()
|
|
| 207 |
output_path_component = gr.File(label="Select Output Path")
|
| 208 |
iface = gr.Interface(
|
| 209 |
fn=pdf_to_text,
|
| 210 |
-
inputs=['file'
|
| 211 |
# inputs=["textbox", input_folder_text, "textbox", max_tokens, temp_slider, prob_slider],
|
| 212 |
outputs=output_text,
|
| 213 |
title='COBIx Endoscopy Report De-Identification',
|
|
|
|
| 192 |
# pdftext = file # remove later
|
| 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"
|
|
|
|
| 209 |
output_path_component = gr.File(label="Select Output Path")
|
| 210 |
iface = gr.Interface(
|
| 211 |
fn=pdf_to_text,
|
| 212 |
+
inputs=['file'],
|
| 213 |
# inputs=["textbox", input_folder_text, "textbox", max_tokens, temp_slider, prob_slider],
|
| 214 |
outputs=output_text,
|
| 215 |
title='COBIx Endoscopy Report De-Identification',
|