Spaces:
Sleeping
Sleeping
Thomas Dehaene
commited on
Commit
·
032c174
1
Parent(s):
f60c057
Update streamlit version
Browse files- app.py +6 -6
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -2,11 +2,12 @@ from textwrap import wrap
|
|
| 2 |
|
| 3 |
from transformers import pipeline
|
| 4 |
import nlpaug.augmenter.char as nac
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
|
| 9 |
-
|
| 10 |
To use this:
|
| 11 |
- Enter a text with OCR mistakes and hit 'unscramble':point_down:
|
| 12 |
- Or enter a normal text, scramble it :twisted_rightwards_arrows: and then hit 'unscramble' :point_down:""")
|
|
@@ -25,11 +26,10 @@ def load_model():
|
|
| 25 |
|
| 26 |
ocr_pipeline = load_model()
|
| 27 |
|
| 28 |
-
|
| 29 |
if 'text' not in st.session_state:
|
| 30 |
-
st.session_state
|
| 31 |
|
| 32 |
-
left_area, right_area = st.
|
| 33 |
|
| 34 |
# Format the left area
|
| 35 |
left_area.header("Input")
|
|
|
|
| 2 |
|
| 3 |
from transformers import pipeline
|
| 4 |
import nlpaug.augmenter.char as nac
|
| 5 |
+
import streamlit as st
|
| 6 |
|
| 7 |
+
st.markdown('# ByT5 Dutch OCR Corrector :pill:')
|
| 8 |
+
st.write('This app corrects common dutch OCR mistakes, to showcase how this could be used in an OCR post-processing pipeline.')
|
| 9 |
|
| 10 |
+
st.markdown("""
|
| 11 |
To use this:
|
| 12 |
- Enter a text with OCR mistakes and hit 'unscramble':point_down:
|
| 13 |
- Or enter a normal text, scramble it :twisted_rightwards_arrows: and then hit 'unscramble' :point_down:""")
|
|
|
|
| 26 |
|
| 27 |
ocr_pipeline = load_model()
|
| 28 |
|
|
|
|
| 29 |
if 'text' not in st.session_state:
|
| 30 |
+
st.session_state['text'] = ""
|
| 31 |
|
| 32 |
+
left_area, right_area = st.columns(2)
|
| 33 |
|
| 34 |
# Format the left area
|
| 35 |
left_area.header("Input")
|
requirements.txt
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
nlpaug==1.1.7
|
|
|
|
| 2 |
torch==1.9.1
|
| 3 |
torchvision==0.10.1
|
| 4 |
transformers==4.10.3
|
|
|
|
| 1 |
nlpaug==1.1.7
|
| 2 |
+
streamlit==1.0.0
|
| 3 |
torch==1.9.1
|
| 4 |
torchvision==0.10.1
|
| 5 |
transformers==4.10.3
|