Spaces:
Running
Running
fix
Browse files
app.py
CHANGED
|
@@ -97,23 +97,16 @@ def process_ocr_qa(text, lang_choice):
|
|
| 97 |
|
| 98 |
# Create the interface with logo and improved description
|
| 99 |
with gr.Blocks(title="OCR QA Demo") as demo:
|
| 100 |
-
|
| 101 |
-
"""
|
| 102 |
-
<a href="https://impresso-project.ch" target="_blank">
|
| 103 |
-
<img src="https://huggingface.co/spaces/impresso-project/ocrqa-demo/resolve/main/logo.jpeg"
|
| 104 |
-
alt="Impresso Project Logo"
|
| 105 |
-
style="height: 42px; display: block; margin: 5px auto; background-color: white;">
|
| 106 |
-
</a>
|
| 107 |
-
"""
|
| 108 |
-
)
|
| 109 |
gr.Markdown(
|
| 110 |
"""
|
| 111 |
# π Optical Character Recognition (OCR) Quality Assessment Demo
|
| 112 |
|
| 113 |
-
This demo evaluates OCR quality by comparing the unique words in a text against large reference vocabularies.
|
|
|
|
| 114 |
It reports:
|
| 115 |
- **potential OCR errors** (unrecognized unique tokens) and known tokens
|
| 116 |
-
- an overall **quality score** between 0.0 (poor) and 1.0 (perfect), defined as `score = known/(known +
|
| 117 |
|
| 118 |
|
| 119 |
Try the German example below or paste your own OCR text.
|
|
@@ -146,7 +139,15 @@ with gr.Blocks(title="OCR QA Demo") as demo:
|
|
| 146 |
elem_id="ocr_output"
|
| 147 |
|
| 148 |
)
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
# Info modal/accordion for pipeline details
|
| 152 |
with gr.Accordion("π About the OCR QA Method", open=False, visible=False) as info_accordion:
|
|
|
|
| 97 |
|
| 98 |
# Create the interface with logo and improved description
|
| 99 |
with gr.Blocks(title="OCR QA Demo") as demo:
|
| 100 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
gr.Markdown(
|
| 102 |
"""
|
| 103 |
# π Optical Character Recognition (OCR) Quality Assessment Demo
|
| 104 |
|
| 105 |
+
This demo evaluates OCR quality by comparing the unique words in a text against large reference vocabularies.
|
| 106 |
+
|
| 107 |
It reports:
|
| 108 |
- **potential OCR errors** (unrecognized unique tokens) and known tokens
|
| 109 |
+
- an overall **quality score** between 0.0 (poor) and 1.0 (perfect), defined as `score = known/(known + unrecognized)`
|
| 110 |
|
| 111 |
|
| 112 |
Try the German example below or paste your own OCR text.
|
|
|
|
| 139 |
elem_id="ocr_output"
|
| 140 |
|
| 141 |
)
|
| 142 |
+
gr.HTML(
|
| 143 |
+
"""
|
| 144 |
+
<a href="https://impresso-project.ch" target="_blank">
|
| 145 |
+
<img src="https://huggingface.co/spaces/impresso-project/ocrqa-demo/resolve/main/logo.jpeg"
|
| 146 |
+
alt="Impresso Project Logo"
|
| 147 |
+
style="height: 42px; display: block; margin: 5px auto; background-color: white;">
|
| 148 |
+
</a>
|
| 149 |
+
"""
|
| 150 |
+
)
|
| 151 |
|
| 152 |
# Info modal/accordion for pipeline details
|
| 153 |
with gr.Accordion("π About the OCR QA Method", open=False, visible=False) as info_accordion:
|