Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -103,13 +103,13 @@ def get_text_from_images(images):
|
|
| 103 |
|
| 104 |
for part in parts:
|
| 105 |
part_number += 1
|
| 106 |
-
clear_output()
|
| 107 |
print(f"Images: {image_number}/{len(images)}")
|
| 108 |
print(f"Lines: {line_number}/{len(lines)}")
|
| 109 |
print(f"Parts: {part_number}/{len(parts)}")
|
| 110 |
|
| 111 |
part_image_pil = Image.fromarray(cv2.cvtColor(part, cv2.COLOR_BGR2RGB))
|
| 112 |
-
display(part_image_pil)
|
| 113 |
print("\n".join(extracted_text))
|
| 114 |
|
| 115 |
pixel_values = processor(part_image_pil, return_tensors="pt").pixel_values
|
|
@@ -197,8 +197,8 @@ with gr.Blocks() as demo:
|
|
| 197 |
with gr.Tabs():
|
| 198 |
with gr.TabItem("PDF"):
|
| 199 |
pdf_file = gr.File(label="Upload PDF File", type="binary")
|
| 200 |
-
process_mode = gr.Radio(choices=["
|
| 201 |
-
page_index = gr.Number(label="Page Index", value=0, precision=0
|
| 202 |
pdf_output = gr.Textbox(label="Extracted Text")
|
| 203 |
pdf_button = gr.Button("Extract Text from PDF")
|
| 204 |
|
|
|
|
| 103 |
|
| 104 |
for part in parts:
|
| 105 |
part_number += 1
|
| 106 |
+
#clear_output()
|
| 107 |
print(f"Images: {image_number}/{len(images)}")
|
| 108 |
print(f"Lines: {line_number}/{len(lines)}")
|
| 109 |
print(f"Parts: {part_number}/{len(parts)}")
|
| 110 |
|
| 111 |
part_image_pil = Image.fromarray(cv2.cvtColor(part, cv2.COLOR_BGR2RGB))
|
| 112 |
+
#display(part_image_pil)
|
| 113 |
print("\n".join(extracted_text))
|
| 114 |
|
| 115 |
pixel_values = processor(part_image_pil, return_tensors="pt").pixel_values
|
|
|
|
| 197 |
with gr.Tabs():
|
| 198 |
with gr.TabItem("PDF"):
|
| 199 |
pdf_file = gr.File(label="Upload PDF File", type="binary")
|
| 200 |
+
process_mode = gr.Radio(choices=["single", "all"], label="Process Mode", value="all")
|
| 201 |
+
page_index = gr.Number(label="Page Index", value=0, precision=0)
|
| 202 |
pdf_output = gr.Textbox(label="Extracted Text")
|
| 203 |
pdf_button = gr.Button("Extract Text from PDF")
|
| 204 |
|