milwright commited on
Commit
0419853
·
1 Parent(s): e404682

Fix white space between Document Metadata heading and content

Browse files

- Removed nested container that was causing extra space
- Added direct subheader without extra container wrapper
- Added CSS rules to ensure zero margin between heading and content
- Fixed margin-top property for metadata container
- Added specific selectors to target and eliminate whitespace in metadata section

Files changed (2) hide show
  1. app.py +30 -27
  2. ui/custom.css +13 -0
app.py CHANGED
@@ -1131,33 +1131,36 @@ with main_tab1:
1131
 
1132
  # Document Metadata in the top right of the right column
1133
  with right_col:
1134
- metadata_container = st.container()
1135
- with metadata_container:
1136
- st.subheader("Document Metadata")
1137
- # Create a subtle container for metadata
1138
- st.markdown('<div class="metadata-container">', unsafe_allow_html=True)
1139
- # Display file info
1140
- st.write(f"**File Name:** {result.get('file_name', uploaded_file.name)}")
1141
-
1142
- # Display info if only limited pages were processed
1143
- if 'limited_pages' in result:
1144
- st.info(f"Processed {result['limited_pages']['processed']} of {result['limited_pages']['total']} pages")
1145
-
1146
- # Display languages if available
1147
- if 'languages' in result:
1148
- languages = [lang for lang in result['languages'] if lang is not None]
1149
- if languages:
1150
- st.write(f"**Languages:** {', '.join(languages)}")
1151
-
1152
- # Display topics if available
1153
- if 'topics' in result and result['topics']:
1154
- st.write(f"**Topics:** {', '.join(result['topics'])}")
1155
-
1156
- # Processing time if available
1157
- if 'processing_time' in result:
1158
- proc_time = result['processing_time']
1159
- st.write(f"**Processing Time:** {proc_time:.1f}s")
1160
- st.markdown('</div>', unsafe_allow_html=True)
 
 
 
1161
 
1162
  # Display Document Contents below the metadata in the right column
1163
  st.subheader("Document Contents")
 
1131
 
1132
  # Document Metadata in the top right of the right column
1133
  with right_col:
1134
+ # Directly add the subheader without extra container
1135
+ st.subheader("Document Metadata")
1136
+
1137
+ # Create an inline container with compact styling
1138
+ st.markdown('<div class="metadata-container" style="margin-top:0">', unsafe_allow_html=True)
1139
+
1140
+ # Display file info
1141
+ st.write(f"**File Name:** {result.get('file_name', uploaded_file.name)}")
1142
+
1143
+ # Display info if only limited pages were processed
1144
+ if 'limited_pages' in result:
1145
+ st.info(f"Processed {result['limited_pages']['processed']} of {result['limited_pages']['total']} pages")
1146
+
1147
+ # Display languages if available
1148
+ if 'languages' in result:
1149
+ languages = [lang for lang in result['languages'] if lang is not None]
1150
+ if languages:
1151
+ st.write(f"**Languages:** {', '.join(languages)}")
1152
+
1153
+ # Display topics if available
1154
+ if 'topics' in result and result['topics']:
1155
+ st.write(f"**Topics:** {', '.join(result['topics'])}")
1156
+
1157
+ # Processing time if available
1158
+ if 'processing_time' in result:
1159
+ proc_time = result['processing_time']
1160
+ st.write(f"**Processing Time:** {proc_time:.1f}s")
1161
+
1162
+ # Close the metadata container
1163
+ st.markdown('</div>', unsafe_allow_html=True)
1164
 
1165
  # Display Document Contents below the metadata in the right column
1166
  st.subheader("Document Contents")
ui/custom.css CHANGED
@@ -94,9 +94,22 @@
94
  border-radius: 4px;
95
  padding: 12px;
96
  margin-bottom: 20px;
 
97
  border-left: 3px solid #4285f4;
98
  }
99
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  /* Fix fullscreen button styling */
101
  button[title="View fullscreen"],
102
  button.streamlit-expanderHeader {
 
94
  border-radius: 4px;
95
  padding: 12px;
96
  margin-bottom: 20px;
97
+ margin-top: 0px !important;
98
  border-left: 3px solid #4285f4;
99
  }
100
 
101
+ /* Fix spacing for headings above metadata container */
102
+ .element-container h3 + div .metadata-container,
103
+ .element-container h1 + div .metadata-container,
104
+ .element-container h2 + div .metadata-container {
105
+ margin-top: 0 !important;
106
+ }
107
+
108
+ /* Remove excess space between metadata heading and content */
109
+ .stMarkdown + div div.element-container {
110
+ margin-top: 0 !important;
111
+ }
112
+
113
  /* Fix fullscreen button styling */
114
  button[title="View fullscreen"],
115
  button.streamlit-expanderHeader {