KZTech commited on
Commit
5a49c3d
·
verified ·
1 Parent(s): f671bce

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from PIL import Image
3
+ import pytesseract
4
+
5
+ st.set_page_config(page_title="Image to Text OCR", layout="centered")
6
+ st.title("🖼️ Image to Text Converter")
7
+ st.write("Upload an image and extract text using Optical Character Recognition (OCR).")
8
+
9
+ uploaded_file = st.file_uploader("Choose an image", type=["jpg", "jpeg", "png"])
10
+
11
+ if uploaded_file:
12
+ image = Image.open(uploaded_file)
13
+ st.image(image, caption="Uploaded Image", use_column_width=True)
14
+
15
+ if st.button("Extract Text"):
16
+ with st.spinner("Running OCR..."):
17
+ text = pytesseract.image_to_string(image)
18
+ st.subheader("Extracted Text")
19
+ st.text_area("OCR Result", value=text, height=300)