Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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="
|
6 |
-
st.title("🖼️ Image to Text
|
7 |
-
st.write("Upload an image and extract text using Optical Character Recognition (OCR).")
|
8 |
|
9 |
-
uploaded_file = st.file_uploader("
|
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("
|
17 |
text = pytesseract.image_to_string(image)
|
18 |
st.subheader("Extracted Text")
|
19 |
-
st.text_area("
|
|
|
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 |
|