KZTech commited on
Commit
4c46b65
·
verified ·
1 Parent(s): 726d4d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -2,19 +2,19 @@ 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)
 
20
 
 
2
  from PIL import Image
3
  import pytesseract
4
 
5
+ st.set_page_config(page_title="OCR App", layout="centered")
6
+ st.title("🖼️ OCR - Image to Text")
 
7
 
8
+ uploaded_file = st.file_uploader("Upload an image", type=["png", "jpg", "jpeg"])
9
 
10
  if uploaded_file:
11
  image = Image.open(uploaded_file)
12
  st.image(image, caption="Uploaded Image", use_column_width=True)
13
 
14
  if st.button("Extract Text"):
15
+ with st.spinner("Extracting..."):
16
  text = pytesseract.image_to_string(image)
17
  st.subheader("Extracted Text")
18
+ st.text_area("Result", text, height=300)
19
+
20