codeFlowType:
codeMistake
codeFlowLang:
Python
Pip install easyocr pip install streamlit pip install opencv-python pip install numpy import streamlit as st import easyocr import cv2 import numpy as np
st.title("Оптическое распознавание символов")
uploaded_file = st.file_uploader("Загрузите изображение", type=["jpg", "png", "jpeg"])
if uploaded_file is not None: image = np.array(cv2.imdecode(np.frombuffer(uploaded_file.read(), np.uint8), -1))
st.image(image, caption="Полученное изображение", use_column_width=True)
if st.button("Найти текст"):
reader = easyocr.Reader(['en', 'ru'], gpu=False)
result = reader.readtext(image)
detected_text = ""
for item in result: detected_text += item[1] + "\n"
st.subheader("Найденный текст")
st.write(detected_text) streamlit run ocr_app.py
!pip install easyocr
!pip install streamlit
!pip install opencv-python
!pip install numpy
import streamlit as st
import easyocr
import cv2
import numpy as np
st.title("Оптическое распознавание символов")
uploaded_file = st.file_uploader("Загрузите изображение", type=["jpg", "png", "jpeg"])
if uploaded_file is not None:
image = np.array(cv2.imdecode(np.frombuffer(uploaded_file.read(), np.uint8), -1))
st.image(image, caption="Полученное изображение", use_column_width=True)
if st.button("Найти текст"):
reader = easyocr.Reader(['en', 'ru'], gpu=False)
result = reader.readtext(image)
detected_text = ""
for item in result:
detected_text += item[1] + "\n"
st.subheader("Найденный текст")
st.write(detected_text)