Spaces:
Running
Running
upload
Browse files- README.md +1 -1
- app.py +8 -3
- requirements.txt +2 -0
README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
---
|
2 |
title: Japanese OCR
|
3 |
-
emoji:
|
4 |
colorFrom: yellow
|
5 |
colorTo: blue
|
6 |
sdk: gradio
|
|
|
1 |
---
|
2 |
title: Japanese OCR
|
3 |
+
emoji: ⛩
|
4 |
colorFrom: yellow
|
5 |
colorTo: blue
|
6 |
sdk: gradio
|
app.py
CHANGED
@@ -10,7 +10,11 @@ feature_extractor = AutoFeatureExtractor.from_pretrained(model_path)
|
|
10 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
11 |
model = VisionEncoderDecoderModel.from_pretrained(model_path)
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
14 |
def post_process(text):
|
15 |
text = ''.join(text.split())
|
16 |
text = text.replace('…', '...')
|
@@ -33,9 +37,10 @@ iface = gr.Interface(
|
|
33 |
outputs="text",
|
34 |
layout="horizontal",
|
35 |
theme="huggingface",
|
36 |
-
title="Optical
|
37 |
description="A simple interface for OCR from Japanese manga",
|
38 |
article= "Author: <a href=\"https://huggingface.co/vumichien\">Vu Minh Chien</a>. ",
|
39 |
allow_flagging='never',
|
|
|
40 |
)
|
41 |
-
iface.launch(enable_queue=True,
|
|
|
10 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
11 |
model = VisionEncoderDecoderModel.from_pretrained(model_path)
|
12 |
|
13 |
+
examples = ['examples/01.png', 'examples/02.png', 'examples/03.png',
|
14 |
+
'examples/04.png', 'examples/05.png', 'examples/06.png',
|
15 |
+
'examples/07.png'
|
16 |
+
]
|
17 |
+
|
18 |
def post_process(text):
|
19 |
text = ''.join(text.split())
|
20 |
text = text.replace('…', '...')
|
|
|
37 |
outputs="text",
|
38 |
layout="horizontal",
|
39 |
theme="huggingface",
|
40 |
+
title="Optical Character Recognition for Japanese Text",
|
41 |
description="A simple interface for OCR from Japanese manga",
|
42 |
article= "Author: <a href=\"https://huggingface.co/vumichien\">Vu Minh Chien</a>. ",
|
43 |
allow_flagging='never',
|
44 |
+
examples=examples
|
45 |
)
|
46 |
+
iface.launch(enable_queue=True, cache_examples=True)
|
requirements.txt
CHANGED
@@ -1,3 +1,5 @@
|
|
1 |
fugashi
|
2 |
unidic_lite
|
3 |
jaconv
|
|
|
|
|
|
1 |
fugashi
|
2 |
unidic_lite
|
3 |
jaconv
|
4 |
+
transformers
|
5 |
+
torch
|