Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,23 @@
|
|
1 |
import streamlit as st
|
|
|
|
|
2 |
|
3 |
-
st.
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
|
7 |
|
|
|
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 |
+
|
7 |
+
st.title("🖼️ Image to Text OCR")
|
8 |
+
st.write("Upload an image, and we'll extract the text for you using Tesseract OCR.")
|
9 |
+
|
10 |
+
uploaded_file = st.file_uploader("Choose an image...", type=["png", "jpg", "jpeg"])
|
11 |
+
|
12 |
+
if uploaded_file is not None:
|
13 |
+
image = Image.open(uploaded_file)
|
14 |
+
st.image(image, caption="Uploaded Image", use_column_width=True)
|
15 |
+
|
16 |
+
with st.spinner("Extracting text..."):
|
17 |
+
text = pytesseract.image_to_string(image)
|
18 |
+
|
19 |
+
st.subheader("📄 Extracted Text:")
|
20 |
+
st.text_area("OCR Output", text, height=300)
|
21 |
|
22 |
|
23 |
|