Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -77,7 +77,7 @@ def pdf_pil(file_path,page_num):
|
|
| 77 |
|
| 78 |
return (f"image_{page_num}.png")
|
| 79 |
|
| 80 |
-
def ocrpdf(file_path,pdf_lang,page_num):
|
| 81 |
img1 = pdf_pil(file_path,page_num)
|
| 82 |
lang=[f"{ocr_id[pdf_lang]}"]
|
| 83 |
reader = easyocr.Reader(lang)
|
|
@@ -136,11 +136,15 @@ with gr.Blocks() as app:
|
|
| 136 |
|
| 137 |
with gr.Tab("Summarize"):
|
| 138 |
with gr.Row():
|
| 139 |
-
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
with gr.Row():
|
| 142 |
text_out = gr.Textbox()
|
| 143 |
sum_out = gr.Textbox()
|
| 144 |
go_btn.click(scrape,inp,outp)
|
| 145 |
-
sum_btn.click(scrape00,[inp,pg_num,target_lang],[text_out,sum_out])
|
| 146 |
app.queue(concurrency_count=10).launch()
|
|
|
|
| 77 |
|
| 78 |
return (f"image_{page_num}.png")
|
| 79 |
|
| 80 |
+
def ocrpdf(file_path,pdf_lang,page_num,sent_wid,):
|
| 81 |
img1 = pdf_pil(file_path,page_num)
|
| 82 |
lang=[f"{ocr_id[pdf_lang]}"]
|
| 83 |
reader = easyocr.Reader(lang)
|
|
|
|
| 136 |
|
| 137 |
with gr.Tab("Summarize"):
|
| 138 |
with gr.Row():
|
| 139 |
+
with gr.Box():
|
| 140 |
+
sent_wid=gr.Slider(0.1, 3, step=0.1,value=1,label="Horizontal Word Space")
|
| 141 |
+
contrast_det=gr.Slider(0.1, 1, step=0.1,value=0.1,label="Contrast Threshold")
|
| 142 |
+
with gr.Column():
|
| 143 |
+
target_lang = gr.Dropdown(label="PDF Language", choices=list(ocr_id.keys()),value="English")
|
| 144 |
+
sum_btn = gr.Button("Summarize")
|
| 145 |
with gr.Row():
|
| 146 |
text_out = gr.Textbox()
|
| 147 |
sum_out = gr.Textbox()
|
| 148 |
go_btn.click(scrape,inp,outp)
|
| 149 |
+
sum_btn.click(scrape00,[inp,pg_num,target_lang,sent_wid,contrast_det],[text_out,sum_out])
|
| 150 |
app.queue(concurrency_count=10).launch()
|