Spaces:
Runtime error
Runtime error
Commit
·
3d64db0
1
Parent(s):
18f20c2
Update app.py
Browse files
app.py
CHANGED
@@ -2,11 +2,10 @@ import PIL
|
|
2 |
from PIL import ImageDraw
|
3 |
from PIL import Image
|
4 |
import streamlit as st
|
5 |
-
import sentencepiece
|
6 |
-
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
|
7 |
-
|
8 |
-
|
9 |
|
|
|
|
|
|
|
10 |
|
11 |
def load_image(image_file):
|
12 |
img = PIL.Image.open(image_file)
|
@@ -20,13 +19,11 @@ if uploaded_file is not None:
|
|
20 |
st.write(file_details)
|
21 |
image = load_image(uploaded_file)
|
22 |
st.image(image,width=250)
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
29 |
-
st.write(generated_text)
|
30 |
|
31 |
|
32 |
|
|
|
2 |
from PIL import ImageDraw
|
3 |
from PIL import Image
|
4 |
import streamlit as st
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
import os
|
7 |
+
os.system('pip install git+git://github.com/jaidedai/easyocr.git')
|
8 |
+
import easyocr
|
9 |
|
10 |
def load_image(image_file):
|
11 |
img = PIL.Image.open(image_file)
|
|
|
19 |
st.write(file_details)
|
20 |
image = load_image(uploaded_file)
|
21 |
st.image(image,width=250)
|
22 |
+
reader = easyocr.Reader(['en'],gpu=True)
|
23 |
+
bound = reader.readtext(image)
|
24 |
+
st.write(str(bound))
|
25 |
+
|
26 |
+
|
|
|
|
|
27 |
|
28 |
|
29 |
|