Spaces:
Sleeping
Sleeping
Download app.py from LVKinyanjui/ImageToText: direct link, hf CLI and curl.
- Browser
- Download file 562 Bytes
-
https://huggingface.co/spaces/LVKinyanjui/ImageToText/resolve/main/app.py
- Command line
-
hf download hf://spaces/LVKinyanjui/ImageToText/app.py
-
curl -L -o app.py https://huggingface.co/spaces/LVKinyanjui/ImageToText/resolve/main/app.py
562 Bytes
| import streamlit as st | |
| import pytesseract | |
| from PIL import Image | |
| st.write("## Tesseract OCR \n A simple Image to Text Application") | |
| #TODO: Limit input to supported image files | |
| file = st.file_uploader("Choose a file", type=['png', 'jpg']) | |
| def transcribe(file): | |
| image = Image.open(file) | |
| ocr_text = pytesseract.image_to_string(image) | |
| return ocr_text, image | |
| if file is not None: | |
| st.write("Image uploaded succesfully!") | |
| ocr_text, image = transcribe(file) | |
| st.image(image) | |
| st.write("### Recognized Text") | |
| ocr_text | |