ez326 commited on
Commit
c351604
·
verified ·
1 Parent(s): 086e34b

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -12
app.py CHANGED
@@ -4,12 +4,17 @@ st.set_page_config(layout="wide")
4
 
5
  css = """
6
  <style>
7
- /* Remove extra spacing from paragraphs in markdown */
8
  .stMarkdown p {
9
  margin: 0 !important;
10
  padding: 0 !important;
11
  }
12
- /* Criteria header and description compact styling */
 
 
 
 
 
13
  .criteria-name {
14
  font-size: 14px;
15
  font-weight: bold;
@@ -19,11 +24,11 @@ css = """
19
  font-size: 12px;
20
  color: #555;
21
  margin-top: 0px;
22
- margin-bottom: 0px; /* Remove gap below description */
23
  }
24
  .subcriteria {
25
- margin-bottom: 0px; /* Remove extra bottom margin */
26
- padding: 0px; /* Remove padding */
27
  }
28
  .category-header {
29
  margin-top: 6px;
@@ -38,12 +43,13 @@ css = """
38
  margin-bottom: 6px;
39
  font-size: 20px;
40
  }
41
- /* Enlarge the slider thumb for easier touch */
42
  div[data-baseweb="slider"] .Thumb {
43
  width: 24px !important;
44
  height: 24px !important;
45
  }
46
- /* Hide slider tick marks, tick bar, min/max texts, and the empty label */
 
47
  div[data-baseweb="slider"] .Tick,
48
  div[data-baseweb="slider"] .TickBar,
49
  div[data-testid="stSliderTickBarMin"],
@@ -56,7 +62,7 @@ css = """
56
  .stSlider {
57
  margin-top: 0px !important;
58
  }
59
- /* Prevent header columns from stacking on mobile and reduce padding */
60
  @media (max-width: 600px) {
61
  .stHorizontalBlock {
62
  flex-wrap: nowrap !important;
@@ -66,7 +72,7 @@ css = """
66
  padding-right: 2px !important;
67
  min-width: 0;
68
  }
69
- /* Reduce checkbox size further on mobile */
70
  .stCheckbox {
71
  transform: scale(0.8);
72
  transform-origin: left center;
@@ -76,7 +82,7 @@ css = """
76
  """
77
  st.markdown(css, unsafe_allow_html=True)
78
 
79
- # Define criteria grouped by category with names and descriptions
80
  criteria = {
81
  "Writing": [
82
  {"name": "Dialogue", "description": "Word choice, realism, subtext, and implications."},
@@ -134,8 +140,8 @@ st.markdown("<h1 class='app-header'>Movie Rating System</h1>", unsafe_allow_html
134
  ratings = []
135
 
136
  # For each category and criterion, display:
137
- # - A header row (criterion name and a small include checkbox)
138
- # - Immediately below, the description and then the slider with no extra vertical space.
139
  for group, subcriteria in criteria.items():
140
  st.markdown(f"<div class='category-header'>{group}</div>", unsafe_allow_html=True)
141
  for idx, crit in enumerate(subcriteria):
 
4
 
5
  css = """
6
  <style>
7
+ /* Remove margins/padding on markdown paragraphs */
8
  .stMarkdown p {
9
  margin: 0 !important;
10
  padding: 0 !important;
11
  }
12
+ /* Hide empty markdown containers */
13
+ div[data-testid="stMarkdownContainer"]:empty,
14
+ p:empty {
15
+ display: none !important;
16
+ }
17
+ /* Compact styling for criteria text */
18
  .criteria-name {
19
  font-size: 14px;
20
  font-weight: bold;
 
24
  font-size: 12px;
25
  color: #555;
26
  margin-top: 0px;
27
+ margin-bottom: 0px;
28
  }
29
  .subcriteria {
30
+ margin-bottom: 0px;
31
+ padding: 0px;
32
  }
33
  .category-header {
34
  margin-top: 6px;
 
43
  margin-bottom: 6px;
44
  font-size: 20px;
45
  }
46
+ /* Enlarge slider thumb for easier touch */
47
  div[data-baseweb="slider"] .Thumb {
48
  width: 24px !important;
49
  height: 24px !important;
50
  }
51
+ /* Hide slider tick marks, tick bar, min/max texts,
52
+ and the empty label element that creates extra vertical space */
53
  div[data-baseweb="slider"] .Tick,
54
  div[data-baseweb="slider"] .TickBar,
55
  div[data-testid="stSliderTickBarMin"],
 
62
  .stSlider {
63
  margin-top: 0px !important;
64
  }
65
+ /* Ensure header row stays inline on mobile */
66
  @media (max-width: 600px) {
67
  .stHorizontalBlock {
68
  flex-wrap: nowrap !important;
 
72
  padding-right: 2px !important;
73
  min-width: 0;
74
  }
75
+ /* Reduce checkbox size on mobile */
76
  .stCheckbox {
77
  transform: scale(0.8);
78
  transform-origin: left center;
 
82
  """
83
  st.markdown(css, unsafe_allow_html=True)
84
 
85
+ # Define criteria
86
  criteria = {
87
  "Writing": [
88
  {"name": "Dialogue", "description": "Word choice, realism, subtext, and implications."},
 
140
  ratings = []
141
 
142
  # For each category and criterion, display:
143
+ # - A header row with the criterion name and a small include checkbox,
144
+ # - Immediately below, the description and the slider, with no extra vertical spacing.
145
  for group, subcriteria in criteria.items():
146
  st.markdown(f"<div class='category-header'>{group}</div>", unsafe_allow_html=True)
147
  for idx, crit in enumerate(subcriteria):