Spaces:
Running
Running
Fix streamlit compatibility issues and update version requirements
Browse files- app.py +7 -7
- requirements.txt +1 -1
app.py
CHANGED
@@ -827,7 +827,7 @@ with main_tab2:
|
|
827 |
images = page.get('images', [])
|
828 |
for img in images:
|
829 |
if 'image_base64' in img:
|
830 |
-
st.image(img['image_base64'],
|
831 |
|
832 |
# Display text content if available
|
833 |
text_content = page.get('markdown', '')
|
@@ -925,7 +925,7 @@ with main_tab1:
|
|
925 |
|
926 |
# Process button - flush left with similar padding as file browser
|
927 |
with left_col:
|
928 |
-
process_button = st.button("Process Document",
|
929 |
|
930 |
# Image preprocessing preview in upload column, right after the process button
|
931 |
if any(preprocessing_options.values()) and uploaded_file.type.startswith('image/'):
|
@@ -934,13 +934,13 @@ with main_tab1:
|
|
934 |
|
935 |
with preview_cols[0]:
|
936 |
st.markdown("**Original Image**")
|
937 |
-
st.image(uploaded_file,
|
938 |
|
939 |
with preview_cols[1]:
|
940 |
st.markdown("**Preprocessed Image**")
|
941 |
try:
|
942 |
processed_bytes = preprocess_image(uploaded_file.getvalue(), preprocessing_options)
|
943 |
-
st.image(io.BytesIO(processed_bytes),
|
944 |
except Exception as e:
|
945 |
st.error(f"Error in preprocessing: {str(e)}")
|
946 |
st.info("Try using grayscale preprocessing for PNG images with transparency")
|
@@ -1636,7 +1636,7 @@ with main_tab1:
|
|
1636 |
with columns1[i]:
|
1637 |
if img_path.suffix.lower() in ['.jpg', '.jpeg', '.png', '.tif']:
|
1638 |
try:
|
1639 |
-
st.image(str(img_path), caption=img_path.name,
|
1640 |
except Exception:
|
1641 |
st.info(f"Example: {img_path.name}")
|
1642 |
else:
|
@@ -1649,7 +1649,7 @@ with main_tab1:
|
|
1649 |
with columns2[i]:
|
1650 |
if img_path.suffix.lower() in ['.jpg', '.jpeg', '.png', '.tif']:
|
1651 |
try:
|
1652 |
-
st.image(str(img_path), caption=img_path.name,
|
1653 |
except Exception:
|
1654 |
st.info(f"Example: {img_path.name}")
|
1655 |
else:
|
@@ -1662,7 +1662,7 @@ with main_tab1:
|
|
1662 |
with columns[i % len(columns)]:
|
1663 |
if img_path.suffix.lower() in ['.jpg', '.jpeg', '.png', '.tif']:
|
1664 |
try:
|
1665 |
-
st.image(str(img_path), caption=img_path.name,
|
1666 |
except Exception:
|
1667 |
st.info(f"Example: {img_path.name}")
|
1668 |
else:
|
|
|
827 |
images = page.get('images', [])
|
828 |
for img in images:
|
829 |
if 'image_base64' in img:
|
830 |
+
st.image(img['image_base64'], width=600)
|
831 |
|
832 |
# Display text content if available
|
833 |
text_content = page.get('markdown', '')
|
|
|
925 |
|
926 |
# Process button - flush left with similar padding as file browser
|
927 |
with left_col:
|
928 |
+
process_button = st.button("Process Document", width=300)
|
929 |
|
930 |
# Image preprocessing preview in upload column, right after the process button
|
931 |
if any(preprocessing_options.values()) and uploaded_file.type.startswith('image/'):
|
|
|
934 |
|
935 |
with preview_cols[0]:
|
936 |
st.markdown("**Original Image**")
|
937 |
+
st.image(uploaded_file, width=600)
|
938 |
|
939 |
with preview_cols[1]:
|
940 |
st.markdown("**Preprocessed Image**")
|
941 |
try:
|
942 |
processed_bytes = preprocess_image(uploaded_file.getvalue(), preprocessing_options)
|
943 |
+
st.image(io.BytesIO(processed_bytes), width=600)
|
944 |
except Exception as e:
|
945 |
st.error(f"Error in preprocessing: {str(e)}")
|
946 |
st.info("Try using grayscale preprocessing for PNG images with transparency")
|
|
|
1636 |
with columns1[i]:
|
1637 |
if img_path.suffix.lower() in ['.jpg', '.jpeg', '.png', '.tif']:
|
1638 |
try:
|
1639 |
+
st.image(str(img_path), caption=img_path.name, width=300)
|
1640 |
except Exception:
|
1641 |
st.info(f"Example: {img_path.name}")
|
1642 |
else:
|
|
|
1649 |
with columns2[i]:
|
1650 |
if img_path.suffix.lower() in ['.jpg', '.jpeg', '.png', '.tif']:
|
1651 |
try:
|
1652 |
+
st.image(str(img_path), caption=img_path.name, width=300)
|
1653 |
except Exception:
|
1654 |
st.info(f"Example: {img_path.name}")
|
1655 |
else:
|
|
|
1662 |
with columns[i % len(columns)]:
|
1663 |
if img_path.suffix.lower() in ['.jpg', '.jpeg', '.png', '.tif']:
|
1664 |
try:
|
1665 |
+
st.image(str(img_path), caption=img_path.name, width=300)
|
1666 |
except Exception:
|
1667 |
st.info(f"Example: {img_path.name}")
|
1668 |
else:
|
requirements.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
# Generated requirements for Hugging Face Spaces deployment
|
2 |
|
3 |
-
streamlit>=1.
|
4 |
mistralai>=0.0.3
|
5 |
Pillow>=9.0.0
|
6 |
opencv-python-headless>=4.5.0
|
|
|
1 |
# Generated requirements for Hugging Face Spaces deployment
|
2 |
|
3 |
+
streamlit>=1.28.0
|
4 |
mistralai>=0.0.3
|
5 |
Pillow>=9.0.0
|
6 |
opencv-python-headless>=4.5.0
|