Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,10 @@ from PIL import Image
|
|
| 3 |
import pytesseract
|
| 4 |
from transformers import pipeline
|
| 5 |
import re
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Load pre-trained model for question-answering
|
| 8 |
qa_pipeline = pipeline("question-answering", model="distilbert-base-uncased-distilled-squad")
|
|
@@ -40,7 +44,7 @@ st.write("Upload an image or handwritten file to process.")
|
|
| 40 |
uploaded_image = st.file_uploader("Upload Handwritten Image", type=["png", "jpg", "jpeg"])
|
| 41 |
|
| 42 |
if uploaded_image:
|
| 43 |
-
st.image(uploaded_image, caption="Uploaded Handwritten File",
|
| 44 |
|
| 45 |
# Extract text using OCR
|
| 46 |
extracted_text = extract_text_from_image(uploaded_image)
|
|
|
|
| 3 |
import pytesseract
|
| 4 |
from transformers import pipeline
|
| 5 |
import re
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
# Install Tesseract OCR during runtime
|
| 9 |
+
os.system("apt-get update && apt-get install -y tesseract-ocr")
|
| 10 |
|
| 11 |
# Load pre-trained model for question-answering
|
| 12 |
qa_pipeline = pipeline("question-answering", model="distilbert-base-uncased-distilled-squad")
|
|
|
|
| 44 |
uploaded_image = st.file_uploader("Upload Handwritten Image", type=["png", "jpg", "jpeg"])
|
| 45 |
|
| 46 |
if uploaded_image:
|
| 47 |
+
st.image(uploaded_image, caption="Uploaded Handwritten File", use_container_width=True)
|
| 48 |
|
| 49 |
# Extract text using OCR
|
| 50 |
extracted_text = extract_text_from_image(uploaded_image)
|