Spaces:
Running
Running
Improve UI text and instructions
Browse files- Only include 'Applied:' in preprocessing metadata when filters are actually applied
- Move file upload instructions directly into the file uploader label
- Remove redundant upload message when no file is selected
- Simplify and clean up initial text
app.py
CHANGED
@@ -465,12 +465,10 @@ with main_tab1:
|
|
465 |
# File uploader in the left column
|
466 |
with left_col:
|
467 |
st.markdown("""
|
468 |
-
Upload an image or PDF file to get started.
|
469 |
-
|
470 |
Using the latest `mistral-ocr-latest` model for advanced document understanding.
|
471 |
""")
|
472 |
|
473 |
-
uploaded_file = st.file_uploader("Choose a file", type=["pdf", "png", "jpg", "jpeg"])
|
474 |
|
475 |
# Removed seed prompt instructions from here, moving to sidebar
|
476 |
|
@@ -937,21 +935,22 @@ with main_tab1:
|
|
937 |
st.image(io.BytesIO(processed_bytes), width=300)
|
938 |
|
939 |
# Show preprocessing metadata next to the image
|
940 |
-
|
941 |
if preprocessing_options.get("document_type", "standard") != "standard":
|
942 |
-
|
943 |
if preprocessing_options.get("grayscale", False):
|
944 |
-
|
945 |
if preprocessing_options.get("denoise", False):
|
946 |
-
|
947 |
if preprocessing_options.get("contrast", 0) != 0:
|
948 |
-
|
949 |
if preprocessing_options.get("rotation", 0) != 0:
|
950 |
-
|
951 |
|
952 |
-
#
|
953 |
-
|
954 |
-
|
|
|
955 |
except Exception as e:
|
956 |
st.error(f"Error in preprocessing: {str(e)}")
|
957 |
st.info("Try using grayscale preprocessing for PNG images with transparency")
|
@@ -1582,8 +1581,7 @@ with main_tab1:
|
|
1582 |
except Exception as e:
|
1583 |
st.error(f"Error processing document: {str(e)}")
|
1584 |
else:
|
1585 |
-
#
|
1586 |
-
st.markdown('<div style="text-align: left; width: auto; display: inline-block;">Upload a document to get started using the file uploader above.</div>', unsafe_allow_html=True)
|
1587 |
|
1588 |
# Show example images in a grid
|
1589 |
st.subheader("Example Documents")
|
|
|
465 |
# File uploader in the left column
|
466 |
with left_col:
|
467 |
st.markdown("""
|
|
|
|
|
468 |
Using the latest `mistral-ocr-latest` model for advanced document understanding.
|
469 |
""")
|
470 |
|
471 |
+
uploaded_file = st.file_uploader("Choose a PDF or image file to get started", type=["pdf", "png", "jpg", "jpeg"])
|
472 |
|
473 |
# Removed seed prompt instructions from here, moving to sidebar
|
474 |
|
|
|
935 |
st.image(io.BytesIO(processed_bytes), width=300)
|
936 |
|
937 |
# Show preprocessing metadata next to the image
|
938 |
+
meta_items = []
|
939 |
if preprocessing_options.get("document_type", "standard") != "standard":
|
940 |
+
meta_items.append(f"Document type ({preprocessing_options['document_type']})")
|
941 |
if preprocessing_options.get("grayscale", False):
|
942 |
+
meta_items.append("Grayscale")
|
943 |
if preprocessing_options.get("denoise", False):
|
944 |
+
meta_items.append("Denoise")
|
945 |
if preprocessing_options.get("contrast", 0) != 0:
|
946 |
+
meta_items.append(f"Contrast ({preprocessing_options['contrast']})")
|
947 |
if preprocessing_options.get("rotation", 0) != 0:
|
948 |
+
meta_items.append(f"Rotation ({preprocessing_options['rotation']}°)")
|
949 |
|
950 |
+
# Only show "Applied:" if there are actual preprocessing steps
|
951 |
+
if meta_items:
|
952 |
+
meta_text = "Applied: " + ", ".join(meta_items)
|
953 |
+
st.caption(meta_text)
|
954 |
except Exception as e:
|
955 |
st.error(f"Error in preprocessing: {str(e)}")
|
956 |
st.info("Try using grayscale preprocessing for PNG images with transparency")
|
|
|
1581 |
except Exception as e:
|
1582 |
st.error(f"Error processing document: {str(e)}")
|
1583 |
else:
|
1584 |
+
# Empty placeholder - we've moved the upload instruction to the file_uploader
|
|
|
1585 |
|
1586 |
# Show example images in a grid
|
1587 |
st.subheader("Example Documents")
|