Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def inference(filepath):
|
5 |
+
return os.popen(f'tesseract {filepath} -').read().strip()
|
6 |
+
|
7 |
+
title = "Tesseract OCR"
|
8 |
+
description = "Gradio demo for Tesseract. Tesseract is an open source text recognition (OCR) Engine."
|
9 |
+
article = "<p style='text-align: center'><a href='https://tesseract-ocr.github.io/' target='_blank'>Tesseract documentation</a> | <a href='https://github.com/tesseract-ocr/tesseract' target='_blank'>Github Repo</a></p>"
|
10 |
+
gr.Interface(
|
11 |
+
inference,
|
12 |
+
[gr.inputs.Image(type="filepath", label="Input")],
|
13 |
+
'text',
|
14 |
+
title=title,
|
15 |
+
description=description,
|
16 |
+
article=article,
|
17 |
+
examples=['eurotext.png']
|
18 |
+
).launch(enable_queue=True,cache_examples=True)
|