Spaces:
Runtime error
Runtime error
Improve demo interface
Browse filesby adding a title, description and a larger input text area.
app.py
CHANGED
|
@@ -8,6 +8,11 @@ from ocrpostcorrection.icdar_data import generate_sentences, process_input_ocr
|
|
| 8 |
from ocrpostcorrection.token_classification import tokenize_and_align_labels
|
| 9 |
from ocrpostcorrection.utils import predictions_to_labels, predictions2entity_output
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
tokenizer_name = 'bert-base-multilingual-cased'
|
| 12 |
model_name = 'jvdzwaan/ocrpostcorrection-task-1'
|
| 13 |
|
|
@@ -45,8 +50,10 @@ def tag(text):
|
|
| 45 |
examples = ['This is a cxample...']
|
| 46 |
|
| 47 |
demo = gr.Interface(tag,
|
| 48 |
-
gr.Textbox(placeholder="Enter sentence here..."),
|
| 49 |
gr.HighlightedText(),
|
|
|
|
|
|
|
| 50 |
examples=examples,
|
| 51 |
allow_flagging='never')
|
| 52 |
|
|
|
|
| 8 |
from ocrpostcorrection.token_classification import tokenize_and_align_labels
|
| 9 |
from ocrpostcorrection.utils import predictions_to_labels, predictions2entity_output
|
| 10 |
|
| 11 |
+
description = """
|
| 12 |
+
Token classifier that predicts whether a token is an OCR mistake or not. More
|
| 13 |
+
information can be found [here](https://jvdzwaan.github.io/ocrpostcorrection/).
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
tokenizer_name = 'bert-base-multilingual-cased'
|
| 17 |
model_name = 'jvdzwaan/ocrpostcorrection-task-1'
|
| 18 |
|
|
|
|
| 50 |
examples = ['This is a cxample...']
|
| 51 |
|
| 52 |
demo = gr.Interface(tag,
|
| 53 |
+
gr.Textbox(placeholder="Enter sentence here...", lines=7),
|
| 54 |
gr.HighlightedText(),
|
| 55 |
+
title='Find OCR mistakes in text',
|
| 56 |
+
description=description,
|
| 57 |
examples=examples,
|
| 58 |
allow_flagging='never')
|
| 59 |
|