Spaces:
Runtime error
Runtime error
Update app.py
Browse files17 unmodified lines181920212122232424252627272829301 unmodified line3233343535363738394041424344454647484950513839401 unmodified line424344455960464748495017 unmodified lines
# main titlest.title("Get text from image with EasyOCR")st.title("Recognize text and locations from flowchart")
# subtitlest.markdown("## EasyOCR with Streamlit")st.markdown("## FlowchartOCR")
# upload image filefile = st.file_uploader(label = "Upload Here", type=['png', 'jpg', 'jpeg'])file = st.file_uploader(label = "Upload Image", type=['png', 'jpg', 'jpeg'])
#read the csv file and display the dataframeif file is not None:1 unmodified line st.image(image) #display
# it will only detect the English and Turkish part of the image as text reader = easyocr.Reader(['en','ja'], gpu=False) reader = easyocr.Reader(['en'], gpu=False) result = reader.readtext(np.array(image)) # turn image to numpy array
# Add a placeholder # latest_iteration = st.empty() # bar = st.progress(0) # for i in range(100): # Update the progress bar with each iteration. # latest_iteration.text(f'Iteration {i+1}') # bar.progress(i + 1) # time.sleep(0.1)
# print all predicted text: for idx in range(len(result)): pred_text = result[idx][1] st.write(pred_text) # collect the results in the dictionary: textdic_easyocr = {}1 unmodified line pred_coor = result[idx][0] pred_text = result[idx][1] pred_confidence = result[idx][2] if(pred_confidence>0.6): textdic_easyocr[pred_text] = {} textdic_easyocr[pred_text]['pred_confidence'] = pred_confidence textdic_easyocr[pred_text] = {} textdic_easyocr[pred_text]['pred_confidence'] = pred_confidence
# create a data frame which shows the predicted text and prediction confidence df = pd.DataFrame.from_dict(textdic_easyocr).Tapp.py+7-20