Spaces:
Runtime error
Runtime error
Commit ·
ee7d3b2
1
Parent(s): 39ba621
Update app.py
Browse files36 unmodified lines3738394041424344454647484950515240414236 unmodified lines # create a dataframe which shows the predicted text and prediction confidence df = pd.DataFrame.from_dict(textdic_easyocr).T st.table(df)
# Plot image with text box and predicted text with cv2 image = cv2.imread(file) for res in result: top_left = tuple(res[0][0]) # top left coordinates as tuple bottom_right = tuple(res[0][2]) # bottom right coordinates as tuple # draw rectangle on image, 2 is thickness cv2.rectangle(image, top_left, bottom_right, (0, 255, 0), 2) # write recognized text on image (top_left) minus 10 pixel on y cv2.putText(image, res[1], (top_left[0], top_left[1]-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2) fig1, ax1 = plt.subplots() plt.imshow(image) plt.show() else: st.write("Upload your image")app.py-13