Spaces:
Runtime error
Runtime error
Commit
·
0c830e5
1
Parent(s):
ee07715
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import easyocr
|
| 2 |
+
import PIL
|
| 3 |
+
from PIL import ImageDraw
|
| 4 |
+
import streamlit as st
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
reader = easyocr.Reader(['en'])
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
url = 'https://fki.tic.heia-fr.ch/static/img/a01-122-02-00.jpg'
|
| 12 |
+
img = Image.open(requests.get(url, stream=True).raw).convert("RGB")
|
| 13 |
+
bound = reader.readtext(img)
|
| 14 |
+
for i in range(len(bound)):
|
| 15 |
+
bb = bound[i]
|
| 16 |
+
left = bb[0][0][0]
|
| 17 |
+
top = bb[0][0][1]
|
| 18 |
+
right = bb[0][2][0]
|
| 19 |
+
bottom = bb[0][2][1]
|
| 20 |
+
st.text(f"bbox {left:.2f. right:.2f top:.2f bottom:.2f}")
|
| 21 |
+
|