Spaces:
Runtime error
Runtime error
Commit ·
ee7d3b2
1
Parent(s): 39ba621
Update app.py
Browse files36 unmodified lines3738394041424344454647484950515253545536 unmodified lines# create a dataframe which shows the predicted text and prediction confidencedf = pd.DataFrame.from_dict(textdic_easyocr).Tst.table(df)# Plot image with text box and predicted text with cv2image = cv2.imread(file)for res in result:top_left = tuple(res[0][0]) # top left coordinates as tuplebottom_right = tuple(res[0][2]) # bottom right coordinates as tuple# draw rectangle on image, 2 is thicknesscv2.rectangle(image, top_left, bottom_right, (0, 255, 0), 2)# write recognized text on image (top_left) minus 10 pixel on ycv2.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")36 unmodified lines37383940414236 unmodified lines# create a dataframe which shows the predicted text and prediction confidencedf = pd.DataFrame.from_dict(textdic_easyocr).Tst.table(df)else:st.write("Upload your image")
app.py-13