KZTech's picture
Update app.py
4c46b65 verified
raw
history blame
594 Bytes
import streamlit as st
from PIL import Image
import pytesseract
st.set_page_config(page_title="OCR App", layout="centered")
st.title("🖼️ OCR - Image to Text")
uploaded_file = st.file_uploader("Upload an image", type=["png", "jpg", "jpeg"])
if uploaded_file:
image = Image.open(uploaded_file)
st.image(image, caption="Uploaded Image", use_column_width=True)
if st.button("Extract Text"):
with st.spinner("Extracting..."):
text = pytesseract.image_to_string(image)
st.subheader("Extracted Text")
st.text_area("Result", text, height=300)