Spaces:
Build error
Build error
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +7 -2
src/streamlit_app.py
CHANGED
|
@@ -31,13 +31,18 @@ def process_image(image_path, gpu=False):
|
|
| 31 |
return img, saved_text
|
| 32 |
|
| 33 |
if uploaded_file:
|
|
|
|
|
|
|
| 34 |
# Save the uploaded file temporarily
|
| 35 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as temp_file:
|
| 36 |
temp_file.write(uploaded_file.read())
|
| 37 |
temp_path = temp_file.name
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
# Show image with bounding boxes
|
| 43 |
st.image(cv2.cvtColor(img_result, cv2.COLOR_BGR2RGB), caption="Detected Text", use_column_width=True)
|
|
|
|
| 31 |
return img, saved_text
|
| 32 |
|
| 33 |
if uploaded_file:
|
| 34 |
+
st.success("β
Image uploaded successfully!")
|
| 35 |
+
|
| 36 |
# Save the uploaded file temporarily
|
| 37 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as temp_file:
|
| 38 |
temp_file.write(uploaded_file.read())
|
| 39 |
temp_path = temp_file.name
|
| 40 |
|
| 41 |
+
with st.spinner("π Running OCR..."):
|
| 42 |
+
# Process image
|
| 43 |
+
img_result, extracted_text = process_image(temp_path)
|
| 44 |
+
|
| 45 |
+
st.success("π OCR complete!")
|
| 46 |
|
| 47 |
# Show image with bounding boxes
|
| 48 |
st.image(cv2.cvtColor(img_result, cv2.COLOR_BGR2RGB), caption="Detected Text", use_column_width=True)
|