Spaces:
Sleeping
Sleeping
Alfonso Velasco
commited on
Commit
·
81b390f
1
Parent(s):
c215624
test
Browse files- app.py +18 -0
- requirements.txt +4 -0
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import easyocr
|
3 |
+
from PIL import Image
|
4 |
+
import numpy as np
|
5 |
+
|
6 |
+
def extract_text_from_image(image):
|
7 |
+
reader = easyocr.Reader(lang_list=['en'], gpu=False)
|
8 |
+
result = reader.readtext(np.array(image), detail=0)
|
9 |
+
return "\n".join(result)
|
10 |
+
|
11 |
+
iface = gr.Interface(
|
12 |
+
fn=extract_text_from_image,
|
13 |
+
inputs=gr.inputs.Image(),
|
14 |
+
outputs="text",
|
15 |
+
live=True,
|
16 |
+
)
|
17 |
+
|
18 |
+
iface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
easyocr
|
2 |
+
gradio
|
3 |
+
numpy
|
4 |
+
pandas
|