Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,9 +18,9 @@ def pdf_to_img(pdf_path):
|
|
18 |
base_img = pdf_document.extract_image(image[0])
|
19 |
image_data = base_img["image"]
|
20 |
img = Image.open(io.BytesIO(image_data))
|
21 |
-
if img.mode == "RGBA":
|
22 |
-
|
23 |
-
|
24 |
extention = base_img['ext']
|
25 |
img.save(open(f"image{counter}.{extention}","wb"))
|
26 |
img_list.append(f"image{counter}.{extention}")
|
@@ -61,7 +61,7 @@ with gr.Blocks(theme=gr.themes.Glass(primary_hue=gr.themes.colors.slate)) as dem
|
|
61 |
|
62 |
with gr.Row():
|
63 |
with gr.Column():
|
64 |
-
output_text = text = gr.Textbox(label="Output", lines=4)
|
65 |
upload_button.click(pdf_to_img, inputs=file_input, outputs=[img_gallery])
|
66 |
upload_button.click(extract_text_from_pdf, inputs=file_input, outputs=[output_text])
|
67 |
demo.launch()
|
|
|
18 |
base_img = pdf_document.extract_image(image[0])
|
19 |
image_data = base_img["image"]
|
20 |
img = Image.open(io.BytesIO(image_data))
|
21 |
+
# if img.mode == "RGBA":
|
22 |
+
# # Convert RGBA image to RGB
|
23 |
+
# img = img.convert("RGB")
|
24 |
extention = base_img['ext']
|
25 |
img.save(open(f"image{counter}.{extention}","wb"))
|
26 |
img_list.append(f"image{counter}.{extention}")
|
|
|
61 |
|
62 |
with gr.Row():
|
63 |
with gr.Column():
|
64 |
+
output_text = text = gr.Textbox(label="Output", lines=4, autoscroll=False)
|
65 |
upload_button.click(pdf_to_img, inputs=file_input, outputs=[img_gallery])
|
66 |
upload_button.click(extract_text_from_pdf, inputs=file_input, outputs=[output_text])
|
67 |
demo.launch()
|