Spaces:
Sleeping
Sleeping
fix: got_ocr
Browse files
app.py
CHANGED
@@ -33,7 +33,7 @@ def pdf_to_images(pdf_path):
|
|
33 |
pix = page.get_pixmap(matrix=mat, alpha=False)
|
34 |
img = Image.frombytes("RGB", [pix.width, pix.height], pix.samples)
|
35 |
|
36 |
-
#
|
37 |
enhancer = ImageEnhance.Contrast(img)
|
38 |
img = enhancer.enhance(1.5) # 增加50%的对比度
|
39 |
|
@@ -118,7 +118,7 @@ def fine_grained_update(fine_grained_type):
|
|
118 |
|
119 |
with gr.Blocks() as demo:
|
120 |
pdf_input = gr.File(label="上传PDF文件")
|
121 |
-
image_gallery = gr.Gallery(label="PDF页面预览", columns=3, height="auto")
|
122 |
selected_index = gr.State(None)
|
123 |
pdf_input.upload(fn=process_pdf, inputs=pdf_input, outputs=image_gallery)
|
124 |
image_gallery.select(fn=on_image_select, inputs=[], outputs=selected_index)
|
|
|
33 |
pix = page.get_pixmap(matrix=mat, alpha=False)
|
34 |
img = Image.frombytes("RGB", [pix.width, pix.height], pix.samples)
|
35 |
|
36 |
+
# 增对比度
|
37 |
enhancer = ImageEnhance.Contrast(img)
|
38 |
img = enhancer.enhance(1.5) # 增加50%的对比度
|
39 |
|
|
|
118 |
|
119 |
with gr.Blocks() as demo:
|
120 |
pdf_input = gr.File(label="上传PDF文件")
|
121 |
+
image_gallery = gr.Gallery(label="PDF页面预览", columns=3, height="auto", max_height=300)
|
122 |
selected_index = gr.State(None)
|
123 |
pdf_input.upload(fn=process_pdf, inputs=pdf_input, outputs=image_gallery)
|
124 |
image_gallery.select(fn=on_image_select, inputs=[], outputs=selected_index)
|