App where you can opload a image, extract text from it, and when you press a download button the extracted text is downloaded for you.
Drop files here
or click to upload
import streamlit as st
from PIL import Image
import pytesseract
st.title("Image Text Extractor")
# Upload image
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
if uploaded_file is not None:
# Open and display the image
title_image = Image.open(uploaded_file)
st.image(title_image, caption='Uploaded Image.', use_column_width=True)
# Extract text from image
extracted_text = pytesseract.image_to_string(title_image)
st.write("**Extracted Text:**")
st.write(extracted_text)
# Download button for extracted text
st.download_button(
label="Download extracted text",
data=extracted_text,
file_name="extracted_text.txt",
mime="text/plain",
)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?