Spaces:
Build error
Build error
Upload 2 files
Browse files- app5.py +29 -0
- requirements.txt +100 -0
app5.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from PIL import Image
|
| 3 |
+
import pytesseract
|
| 4 |
+
|
| 5 |
+
pytesseract.pytesseract.tesseract_cmd = "/opt/homebrew/bin/tesseract"
|
| 6 |
+
|
| 7 |
+
def extract_text(image):
|
| 8 |
+
try:
|
| 9 |
+
text = pytesseract.image_to_string(image, lang='eng',config='--psm 1')
|
| 10 |
+
return text
|
| 11 |
+
except Exception as e:
|
| 12 |
+
return str(e)
|
| 13 |
+
|
| 14 |
+
def main():
|
| 15 |
+
st.title("Text Extraction from Image in English and Tamil")
|
| 16 |
+
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
|
| 17 |
+
|
| 18 |
+
if uploaded_file is not None:
|
| 19 |
+
image = Image.open(uploaded_file)
|
| 20 |
+
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 21 |
+
|
| 22 |
+
text = extract_text(image)
|
| 23 |
+
|
| 24 |
+
st.success("Text extracted successfully!")
|
| 25 |
+
st.header("Extracted Text:")
|
| 26 |
+
st.write(text)
|
| 27 |
+
|
| 28 |
+
if __name__ == "__main__":
|
| 29 |
+
main()
|
requirements.txt
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
altair==5.2.0
|
| 2 |
+
annotated-types==0.6.0
|
| 3 |
+
anyio==4.2.0
|
| 4 |
+
assemblyai==0.20.2
|
| 5 |
+
attrs==23.2.0
|
| 6 |
+
blinker==1.7.0
|
| 7 |
+
cachetools==5.3.2
|
| 8 |
+
certifi==2023.11.17
|
| 9 |
+
cffi==1.16.0
|
| 10 |
+
charset-normalizer==3.3.2
|
| 11 |
+
click==8.1.7
|
| 12 |
+
colorama==0.4.6
|
| 13 |
+
distro==1.9.0
|
| 14 |
+
exceptiongroup==1.2.0
|
| 15 |
+
fastapi==0.109.2
|
| 16 |
+
ffmpeg-python==0.2.0
|
| 17 |
+
future==0.18.3
|
| 18 |
+
gitdb==4.0.11
|
| 19 |
+
GitPython==3.1.41
|
| 20 |
+
google-api-core==2.16.2
|
| 21 |
+
google-api-python-client==2.116.0
|
| 22 |
+
google-auth==2.27.0
|
| 23 |
+
google-auth-httplib2==0.2.0
|
| 24 |
+
googleapis-common-protos==1.62.0
|
| 25 |
+
gunicorn==21.2.0
|
| 26 |
+
h11==0.14.0
|
| 27 |
+
httpcore==1.0.2
|
| 28 |
+
httplib2==0.22.0
|
| 29 |
+
httptools==0.6.1
|
| 30 |
+
httpx==0.26.0
|
| 31 |
+
idna==3.6
|
| 32 |
+
importlib-metadata==7.0.1
|
| 33 |
+
isodate==0.6.1
|
| 34 |
+
Jinja2==3.1.3
|
| 35 |
+
jsonschema==4.21.1
|
| 36 |
+
jsonschema-specifications==2023.12.1
|
| 37 |
+
lxml==5.1.0
|
| 38 |
+
markdown-it-py==3.0.0
|
| 39 |
+
MarkupSafe==2.1.4
|
| 40 |
+
mdurl==0.1.2
|
| 41 |
+
numpy==1.26.3
|
| 42 |
+
openai==1.10.0
|
| 43 |
+
opencv-python==4.9.0.80
|
| 44 |
+
opencv-python-headless>=4.5.3.56
|
| 45 |
+
outcome==1.3.0.post0
|
| 46 |
+
packaging==23.2
|
| 47 |
+
pandas==2.2.0
|
| 48 |
+
pillow==10.2.0
|
| 49 |
+
protobuf==4.25.2
|
| 50 |
+
pyarrow==15.0.0
|
| 51 |
+
pyasn1==0.5.1
|
| 52 |
+
pyasn1-modules==0.3.0
|
| 53 |
+
pycountry==23.12.11
|
| 54 |
+
pycparser==2.21
|
| 55 |
+
pycryptodome==3.20.0
|
| 56 |
+
pydantic==2.6.0
|
| 57 |
+
pydantic_core==2.16.1
|
| 58 |
+
pydeck==0.8.1b0
|
| 59 |
+
pydub==0.25.1
|
| 60 |
+
Pygments==2.17.2
|
| 61 |
+
pyparsing==3.1.1
|
| 62 |
+
PySocks==1.7.1
|
| 63 |
+
python-dateutil==2.8.2
|
| 64 |
+
python-dotenv==1.0.1
|
| 65 |
+
pytz==2023.4
|
| 66 |
+
PyYAML==6.0.1
|
| 67 |
+
referencing==0.33.0
|
| 68 |
+
requests==2.31.0
|
| 69 |
+
rich==13.7.0
|
| 70 |
+
rpds-py==0.17.1
|
| 71 |
+
rsa==4.9
|
| 72 |
+
six==1.16.0
|
| 73 |
+
smmap==5.0.1
|
| 74 |
+
sniffio==1.3.0
|
| 75 |
+
sortedcontainers==2.4.0
|
| 76 |
+
SpeechRecognition==3.10.1
|
| 77 |
+
starlette==0.36.3
|
| 78 |
+
streamlink==6.5.1
|
| 79 |
+
streamlit==1.31.0
|
| 80 |
+
tenacity==8.2.3
|
| 81 |
+
toml==0.10.2
|
| 82 |
+
toolz==0.12.1
|
| 83 |
+
tornado==6.4
|
| 84 |
+
tqdm==4.66.1
|
| 85 |
+
trio==0.24.0
|
| 86 |
+
trio-websocket==0.11.1
|
| 87 |
+
typing_extensions==4.9.0
|
| 88 |
+
tzdata==2023.4
|
| 89 |
+
tzlocal==5.2
|
| 90 |
+
uritemplate==4.1.1
|
| 91 |
+
urllib3==2.2.0
|
| 92 |
+
uvicorn==0.27.1
|
| 93 |
+
uvloop==0.19.0
|
| 94 |
+
validators==0.22.0
|
| 95 |
+
watchdog==3.0.0
|
| 96 |
+
watchfiles==0.21.0
|
| 97 |
+
websocket-client==1.7.0
|
| 98 |
+
websockets==12.0
|
| 99 |
+
wsproto==1.2.0
|
| 100 |
+
zipp==3.17.0
|