Spaces:
Runtime error
Runtime error
Commit
·
ee7d3b2
1
Parent(s):
39ba621
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,19 +37,6 @@ if file is not None:
|
|
| 37 |
# create a dataframe which shows the predicted text and prediction confidence
|
| 38 |
df = pd.DataFrame.from_dict(textdic_easyocr).T
|
| 39 |
st.table(df)
|
| 40 |
-
|
| 41 |
-
# Plot image with text box and predicted text with cv2
|
| 42 |
-
image = cv2.imread(file)
|
| 43 |
-
for res in result:
|
| 44 |
-
top_left = tuple(res[0][0]) # top left coordinates as tuple
|
| 45 |
-
bottom_right = tuple(res[0][2]) # bottom right coordinates as tuple
|
| 46 |
-
# draw rectangle on image, 2 is thickness
|
| 47 |
-
cv2.rectangle(image, top_left, bottom_right, (0, 255, 0), 2)
|
| 48 |
-
# write recognized text on image (top_left) minus 10 pixel on y
|
| 49 |
-
cv2.putText(image, res[1], (top_left[0], top_left[1]-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)
|
| 50 |
-
fig1, ax1 = plt.subplots()
|
| 51 |
-
plt.imshow(image)
|
| 52 |
-
plt.show()
|
| 53 |
|
| 54 |
else:
|
| 55 |
st.write("Upload your image")
|
|
|
|
| 37 |
# create a dataframe which shows the predicted text and prediction confidence
|
| 38 |
df = pd.DataFrame.from_dict(textdic_easyocr).T
|
| 39 |
st.table(df)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
else:
|
| 42 |
st.write("Upload your image")
|