Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -100,8 +100,8 @@ def ocrpdf(file_path,pdf_lang,page_num):
|
|
| 100 |
|
| 101 |
this = ""
|
| 102 |
for bound in bounds:
|
| 103 |
-
this = (f'{this}'+f'{bound[1]}')
|
| 104 |
-
|
| 105 |
|
| 106 |
|
| 107 |
def scrape(instring):
|
|
@@ -133,8 +133,11 @@ def scrape00(instring, page_num,pdf_lang):
|
|
| 133 |
summarizer = gr.Interface.load("huggingface/facebook/bart-large-cnn")
|
| 134 |
sum_out = summarizer(text)
|
| 135 |
except Exception:
|
| 136 |
-
|
| 137 |
-
|
|
|
|
|
|
|
|
|
|
| 138 |
return text, sum_out
|
| 139 |
|
| 140 |
with gr.Blocks() as app:
|
|
|
|
| 100 |
|
| 101 |
this = ""
|
| 102 |
for bound in bounds:
|
| 103 |
+
this = (f'{this}'+ f'{bound[1]}')
|
| 104 |
+
return this
|
| 105 |
|
| 106 |
|
| 107 |
def scrape(instring):
|
|
|
|
| 133 |
summarizer = gr.Interface.load("huggingface/facebook/bart-large-cnn")
|
| 134 |
sum_out = summarizer(text)
|
| 135 |
except Exception:
|
| 136 |
+
try:
|
| 137 |
+
text = ocrpdf("data.pdf",pdf_lang,page_num)
|
| 138 |
+
sum_out = summarizer(text)
|
| 139 |
+
except Exception:
|
| 140 |
+
sum_out = "Error"
|
| 141 |
return text, sum_out
|
| 142 |
|
| 143 |
with gr.Blocks() as app:
|