Spaces:
No application file
No application file
Commit
•
45b0612
1
Parent(s):
ce793d7
delete
Browse files
app.py
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
from PIL import Image
|
3 |
-
import pytesseract
|
4 |
-
|
5 |
-
# Set Tesseract path
|
6 |
-
pytesseract.pytesseract.tesseract_cmd = '/Tesseract-OCR/tesseract.exe'
|
7 |
-
|
8 |
-
def main():
|
9 |
-
st.title("Image Text Extractor")
|
10 |
-
|
11 |
-
st.write("Upload an image to extract text from it.")
|
12 |
-
uploaded_image = st.file_uploader("Choose an image...", type=["jpg", "png", "jpeg"])
|
13 |
-
|
14 |
-
if uploaded_image is not None:
|
15 |
-
image = Image.open(uploaded_image)
|
16 |
-
st.image(image, caption='Uploaded Image', use_column_width=True)
|
17 |
-
|
18 |
-
st.write("")
|
19 |
-
st.write("Click below to extract text from the image:")
|
20 |
-
if st.button('Extract Text'):
|
21 |
-
extracted_text = pytesseract.image_to_string(image)
|
22 |
-
st.write(extracted_text)
|
23 |
-
|
24 |
-
if __name__ == '__main__':
|
25 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|