Spaces:
Sleeping
Sleeping
Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from PIL import Image
|
3 |
+
|
4 |
+
st.title("Image to Text Converter")
|
5 |
+
|
6 |
+
|
7 |
+
uploaded_image = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
8 |
+
|
9 |
+
|
10 |
+
if uploaded_image is not None:
|
11 |
+
# Display the uploaded image
|
12 |
+
image = Image.open(uploaded_image)
|
13 |
+
st.image(image, caption='Uploaded Image.', use_column_width=True)
|
14 |
+
|
15 |
+
# Extract text from the image
|
16 |
+
st.write("Extracting text from the image...")
|
17 |
+
# Display the extracted text
|
18 |
+
st.text_area("Extracted Text", "desc", height=200)
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
# Instructions for Tesseract OCR
|
23 |
+
st.sidebar.title("Instructions")
|
24 |
+
st.sidebar.write(
|
25 |
+
"""
|
26 |
+
1. Upload an image using the file uploader.
|
27 |
+
2. Wait for the app to process and extract text from the image.
|
28 |
+
3. The extracted text will be displayed in the text area.
|
29 |
+
"""
|
30 |
+
)
|