Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +3 -5
src/streamlit_app.py
CHANGED
|
@@ -180,7 +180,7 @@ def perform_ocr(image, bbox):
|
|
| 180 |
except Exception as e:
|
| 181 |
return f"OCR Error: {str(e)}"
|
| 182 |
|
| 183 |
-
def scale_image_to_fixed_size(image, max_width=
|
| 184 |
"""Scale image to fit within max dimensions while maintaining aspect ratio - NO PADDING"""
|
| 185 |
# Convert to RGB with proper handling
|
| 186 |
if image.mode not in ('RGB', 'RGBA'):
|
|
@@ -681,10 +681,8 @@ elif st.session_state.page == 'viewer':
|
|
| 681 |
st.session_state.edited_data[selected_file]['gt_parse'] = gt_parse
|
| 682 |
st.session_state.modified_indices.add(selected_file)
|
| 683 |
|
| 684 |
-
#
|
| 685 |
-
|
| 686 |
-
st.session_state.ocr_active_field = None
|
| 687 |
-
st.session_state.ocr_line_item_row = None
|
| 688 |
|
| 689 |
# Clear canvas for next OCR by bumping canvas_key then rerun
|
| 690 |
st.session_state.canvas_key += 1
|
|
|
|
| 180 |
except Exception as e:
|
| 181 |
return f"OCR Error: {str(e)}"
|
| 182 |
|
| 183 |
+
def scale_image_to_fixed_size(image, max_width=900, max_height=1100):
|
| 184 |
"""Scale image to fit within max dimensions while maintaining aspect ratio - NO PADDING"""
|
| 185 |
# Convert to RGB with proper handling
|
| 186 |
if image.mode not in ('RGB', 'RGBA'):
|
|
|
|
| 681 |
st.session_state.edited_data[selected_file]['gt_parse'] = gt_parse
|
| 682 |
st.session_state.modified_indices.add(selected_file)
|
| 683 |
|
| 684 |
+
# Keep the OCR field active so user can draw multiple rectangles for the same field
|
| 685 |
+
# Field will only change when user clicks a different OCR button
|
|
|
|
|
|
|
| 686 |
|
| 687 |
# Clear canvas for next OCR by bumping canvas_key then rerun
|
| 688 |
st.session_state.canvas_key += 1
|