Danieldu
commited on
Commit
•
6c21fbb
1
Parent(s):
f7524d1
update interface
Browse files- .gitignore +4 -0
- app.py +8 -7
.gitignore
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
ppocr/data/__pycache__
|
2 |
ppocr/data/imaug/__pycache__
|
3 |
ppocr/data/imaug/text_image_aug/__pycache__
|
@@ -17,6 +19,8 @@ ppstructure/kie/__pycache__
|
|
17 |
ppstructure/layout/__pycache__
|
18 |
ppstructure/table/__pycache__
|
19 |
tools/__pycache__
|
|
|
|
|
20 |
|
21 |
|
22 |
|
|
|
1 |
+
__pycache__
|
2 |
+
ppocr/__pycache__
|
3 |
ppocr/data/__pycache__
|
4 |
ppocr/data/imaug/__pycache__
|
5 |
ppocr/data/imaug/text_image_aug/__pycache__
|
|
|
19 |
ppstructure/layout/__pycache__
|
20 |
ppstructure/table/__pycache__
|
21 |
tools/__pycache__
|
22 |
+
tools/infer/__pycache__
|
23 |
+
|
24 |
|
25 |
|
26 |
|
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import os, io
|
2 |
from paddleocr import PaddleOCR, draw_ocr,PPStructure
|
3 |
from ppocr.utils.visual import draw_ser_results
|
4 |
-
from PIL import Image
|
5 |
import gradio as gr
|
6 |
|
7 |
|
@@ -51,27 +51,28 @@ def inference__ppstructure(img_path):
|
|
51 |
return image, "\n".join(result)
|
52 |
|
53 |
with gr.Blocks() as demo:
|
54 |
-
gr.Markdown("Form Understanding Project - Certificate of Diagnosis")
|
55 |
-
gr.Markdown("Support languages
|
|
|
|
|
56 |
gr.Markdown("""
|
57 |
## Usage Description
|
58 |
This interface is designed to process and extract information from Certificates of Diagnosis.
|
59 |
To use this tool:
|
60 |
1. Upload an image of a Certificate of Diagnosis using the 'Upload Image' button.
|
61 |
-
2. Optionally, enter the image URL if the certificate is available online.
|
62 |
3. Click 'Process' to extract information from the uploaded certificate.
|
63 |
4. The processed image and extracted text will be displayed on the right.
|
64 |
""")
|
65 |
with gr.Row():
|
66 |
with gr.Column():
|
|
|
67 |
image_input = gr.Image(type='filepath', label='Upload Image')
|
68 |
-
|
69 |
-
submit_btn = gr.Button("Process")
|
70 |
with gr.Column():
|
71 |
gr.Markdown("#### Processed Image")
|
72 |
image_output = gr.Image(type="pil", label="Processed Image")
|
73 |
gr.Markdown("#### Extracted Text")
|
74 |
-
text_output
|
75 |
|
76 |
submit_btn.click(
|
77 |
inference__ppstructure,
|
|
|
1 |
import os, io
|
2 |
from paddleocr import PaddleOCR, draw_ocr,PPStructure
|
3 |
from ppocr.utils.visual import draw_ser_results
|
4 |
+
from PIL import Image
|
5 |
import gradio as gr
|
6 |
|
7 |
|
|
|
51 |
return image, "\n".join(result)
|
52 |
|
53 |
with gr.Blocks() as demo:
|
54 |
+
gr.Markdown("<h1 style='text-align: center;'>Form Understanding Project - Certificate of Diagnosis</h1>")
|
55 |
+
gr.Markdown("Support languages: Traditional Chinese 🇹🇼")
|
56 |
+
gr.Markdown("version:0.1")
|
57 |
+
|
58 |
gr.Markdown("""
|
59 |
## Usage Description
|
60 |
This interface is designed to process and extract information from Certificates of Diagnosis.
|
61 |
To use this tool:
|
62 |
1. Upload an image of a Certificate of Diagnosis using the 'Upload Image' button.
|
|
|
63 |
3. Click 'Process' to extract information from the uploaded certificate.
|
64 |
4. The processed image and extracted text will be displayed on the right.
|
65 |
""")
|
66 |
with gr.Row():
|
67 |
with gr.Column():
|
68 |
+
gr.Markdown("#### Input Image")
|
69 |
image_input = gr.Image(type='filepath', label='Upload Image')
|
70 |
+
submit_btn = gr.Button("Process")
|
|
|
71 |
with gr.Column():
|
72 |
gr.Markdown("#### Processed Image")
|
73 |
image_output = gr.Image(type="pil", label="Processed Image")
|
74 |
gr.Markdown("#### Extracted Text")
|
75 |
+
text_output = gr.Textbox(label="Extracted Text")
|
76 |
|
77 |
submit_btn.click(
|
78 |
inference__ppstructure,
|