Spaces:
Runtime error
Runtime error
Commit
·
27e3c48
1
Parent(s):
0649739
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
import PIL
|
| 3 |
from PIL import ImageDraw
|
| 4 |
import streamlit as st
|
|
@@ -8,13 +8,13 @@ import streamlit as st
|
|
| 8 |
x = st.slider('Select a value')
|
| 9 |
st.write(x, 'squared is', x * x)
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
for i in range(len(bound)):
|
| 19 |
bb = bound[i]
|
| 20 |
left = bb[0][0][0]
|
|
@@ -22,5 +22,5 @@ for i in range(len(bound)):
|
|
| 22 |
right = bb[0][2][0]
|
| 23 |
bottom = bb[0][2][1]
|
| 24 |
st.text(f"bbox {left:.2f. right:.2f top:.2f bottom:.2f}")
|
| 25 |
-
|
| 26 |
|
|
|
|
| 1 |
+
import easyocr
|
| 2 |
import PIL
|
| 3 |
from PIL import ImageDraw
|
| 4 |
import streamlit as st
|
|
|
|
| 8 |
x = st.slider('Select a value')
|
| 9 |
st.write(x, 'squared is', x * x)
|
| 10 |
|
| 11 |
+
reader = easyocr.Reader(['en'])
|
| 12 |
|
| 13 |
|
| 14 |
+
url = 'https://fki.tic.heia-fr.ch/static/img/a01-122-02-00.jpg'
|
| 15 |
+
img = Image.open(requests.get(url, stream=True).raw).convert("RGB")
|
| 16 |
+
bound = reader.readtext(img)
|
| 17 |
+
|
| 18 |
for i in range(len(bound)):
|
| 19 |
bb = bound[i]
|
| 20 |
left = bb[0][0][0]
|
|
|
|
| 22 |
right = bb[0][2][0]
|
| 23 |
bottom = bb[0][2][1]
|
| 24 |
st.text(f"bbox {left:.2f. right:.2f top:.2f bottom:.2f}")
|
| 25 |
+
|
| 26 |
|