ez326 commited on
Commit
462e149
·
verified ·
1 Parent(s): 62dcd3c

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -64
app.py CHANGED
@@ -9,27 +9,14 @@ css = """
9
  margin: 0 !important;
10
  padding: 0 !important;
11
  }
12
- /* Hide empty markdown containers (that add unwanted space) */
13
- div[data-testid="stMarkdownContainer"]:empty,
14
- p:empty {
15
- display: none !important;
16
- }
17
- /* Criterion name styling */
18
  .criteria-name {
19
  font-size: 14px;
20
  font-weight: bold;
21
- margin-bottom: 0px;
22
  }
23
- /* Description styling: same style as header but slightly smaller */
24
  .criteria-description {
25
  font-size: 12px;
26
  color: #555;
27
- margin: 0px;
28
- }
29
- /* Container adjustments */
30
- .subcriteria {
31
- margin-bottom: 0px;
32
- padding: 0px;
33
  }
34
  .category-header {
35
  margin-top: 6px;
@@ -49,7 +36,7 @@ css = """
49
  width: 24px !important;
50
  height: 24px !important;
51
  }
52
- /* Hide slider tick marks, tick bar, min/max texts, and empty slider labels */
53
  div[data-baseweb="slider"] .Tick,
54
  div[data-baseweb="slider"] .TickBar,
55
  div[data-testid="stSliderTickBarMin"],
@@ -58,7 +45,6 @@ css = """
58
  label[data-testid="stWidgetLabel"][aria-hidden="true"] {
59
  display: none !important;
60
  }
61
- /* Remove extra margin above slider */
62
  .stSlider {
63
  margin-top: 0px !important;
64
  }
@@ -81,7 +67,6 @@ css = """
81
  """
82
  st.markdown(css, unsafe_allow_html=True)
83
 
84
- # Define criteria grouped by category with names and descriptions.
85
  criteria = {
86
  "Writing": [
87
  {"name": "Dialogue", "description": "Word choice, realism, subtext, and implications."},
@@ -89,42 +74,7 @@ criteria = {
89
  {"name": "Character Development", "description": "Depth, relatability, motivations, and arcs."},
90
  {"name": "Theme & Symbolism", "description": "Use of deeper meaning, metaphors, and thematic consistency."}
91
  ],
92
- "Cinematography": [
93
- {"name": "Camera Work", "description": "Shot composition, stability, movement, and angles."},
94
- {"name": "Lighting", "description": "Contrast, exposure control, and mood-setting."},
95
- {"name": "Color Grading", "description": "Palette consistency, contrast, and emotional tone."},
96
- {"name": "Framing & Aspect Ratio", "description": "Use of space, focus, and visual storytelling."}
97
- ],
98
- "Editing & Pacing": [
99
- {"name": "Scene Transitions", "description": "Smoothness, creativity, and effectiveness."},
100
- {"name": "Continuity", "description": "Logical flow and lack of visual inconsistencies."},
101
- {"name": "Pacing", "description": "Balance between slow and fast scenes, engagement level."},
102
- {"name": "Use of Montage", "description": "Storytelling efficiency via edited sequences."}
103
- ],
104
- "Sound": [
105
- {"name": "Dialogue Mixing", "description": "Clarity, balance, and intelligibility of speech."},
106
- {"name": "Foley & Sound Effects", "description": "Realism, accuracy, and integration into the world."},
107
- {"name": "Score & Music", "description": "Uniqueness, memorability, and emotional impact."},
108
- {"name": "Spatial Audio & Atmosphere", "description": "Immersion, ambient sound accuracy, and use of silence."}
109
- ],
110
- "Directing & Performance": [
111
- {"name": "Directing", "description": "Cohesion of vision, creative choices, and execution."},
112
- {"name": "Acting", "description": "Expression, dialogue delivery, and emotional depth."},
113
- {"name": "Blocking & Staging", "description": "Character positioning, movement, and scene composition."},
114
- {"name": "Action & Stunt Choreography", "description": "Realism, execution, and visual readability."}
115
- ],
116
- "Production & Visuals": [
117
- {"name": "Production Design", "description": "Set design, world-building, and authenticity."},
118
- {"name": "Costume & Makeup", "description": "Period accuracy, character enhancement, and detailing."},
119
- {"name": "Practical Effects & Props", "description": "Use of real elements over CGI, believability."},
120
- {"name": "VFX & CGI Integration", "description": "Quality, realism, and seamless blending."}
121
- ],
122
- "Engagement & Replay Value": [
123
- {"name": "Plot", "description": "Uniqueness, engagement, predictability, and emotional weight."},
124
- {"name": "Originality", "description": "Avoidance of clichés, fresh storytelling, and innovation."},
125
- {"name": "Rewatchability", "description": "Whether the movie holds up over multiple viewings."},
126
- {"name": "Emotional Impact", "description": "Strength of connection, intensity of response."}
127
- ]
128
  }
129
 
130
  def calculate_score(ratings):
@@ -138,21 +88,17 @@ def calculate_score(ratings):
138
  st.markdown("<h1 class='app-header'>Movie Rating System</h1>", unsafe_allow_html=True)
139
  ratings = []
140
 
141
- # For each category and criterion, display a header row with:
142
- # - the criterion name,
143
- # - the description (inline, slightly smaller),
144
- # - a small include checkbox.
145
- # Then immediately display the slider below.
146
  for group, subcriteria in criteria.items():
147
  st.markdown(f"<div class='category-header'>{group}</div>", unsafe_allow_html=True)
148
  for idx, crit in enumerate(subcriteria):
149
  with st.container():
150
- # Create one row with three columns:
151
- # column0: criterion name; column1: description; column2: checkbox.
152
- header_cols = st.columns([3, 4, 0.5])
153
- header_cols[0].markdown(f"<span class='criteria-name'>{crit['name']}</span>", unsafe_allow_html=True)
154
- header_cols[1].markdown(f"<span class='criteria-description'>{crit['description']}</span>", unsafe_allow_html=True)
155
- include = header_cols[2].checkbox("", value=True, key=f"include_{group}_{idx}")
156
  # Slider appears immediately below
157
  rating = st.slider("", 1.0, 7.0, 4.0, step=0.1, key=f"slider_{group}_{idx}", disabled=(not include))
158
  ratings.append(None if not include else rating)
 
9
  margin: 0 !important;
10
  padding: 0 !important;
11
  }
12
+ /* Compact styling for criterion name and description */
 
 
 
 
 
13
  .criteria-name {
14
  font-size: 14px;
15
  font-weight: bold;
 
16
  }
 
17
  .criteria-description {
18
  font-size: 12px;
19
  color: #555;
 
 
 
 
 
 
20
  }
21
  .category-header {
22
  margin-top: 6px;
 
36
  width: 24px !important;
37
  height: 24px !important;
38
  }
39
+ /* Hide slider tick marks, tick bar, min/max texts, and empty slider label */
40
  div[data-baseweb="slider"] .Tick,
41
  div[data-baseweb="slider"] .TickBar,
42
  div[data-testid="stSliderTickBarMin"],
 
45
  label[data-testid="stWidgetLabel"][aria-hidden="true"] {
46
  display: none !important;
47
  }
 
48
  .stSlider {
49
  margin-top: 0px !important;
50
  }
 
67
  """
68
  st.markdown(css, unsafe_allow_html=True)
69
 
 
70
  criteria = {
71
  "Writing": [
72
  {"name": "Dialogue", "description": "Word choice, realism, subtext, and implications."},
 
74
  {"name": "Character Development", "description": "Depth, relatability, motivations, and arcs."},
75
  {"name": "Theme & Symbolism", "description": "Use of deeper meaning, metaphors, and thematic consistency."}
76
  ],
77
+ # ... (other categories omitted for brevity)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  }
79
 
80
  def calculate_score(ratings):
 
88
  st.markdown("<h1 class='app-header'>Movie Rating System</h1>", unsafe_allow_html=True)
89
  ratings = []
90
 
91
+ # For each criterion, display a header row with a combined title and description (with 3 non-breaking spaces in between)
 
 
 
 
92
  for group, subcriteria in criteria.items():
93
  st.markdown(f"<div class='category-header'>{group}</div>", unsafe_allow_html=True)
94
  for idx, crit in enumerate(subcriteria):
95
  with st.container():
96
+ # Use two columns: one for the combined title/description, one for the include checkbox.
97
+ cols = st.columns([7, 0.5])
98
+ # Insert three non-breaking spaces between title and description.
99
+ combined = f"<span class='criteria-name'>{crit['name']}</span>&nbsp;&nbsp;&nbsp;<span class='criteria-description'>{crit['description']}</span>"
100
+ cols[0].markdown(combined, unsafe_allow_html=True)
101
+ include = cols[1].checkbox("", value=True, key=f"include_{group}_{idx}")
102
  # Slider appears immediately below
103
  rating = st.slider("", 1.0, 7.0, 4.0, step=0.1, key=f"slider_{group}_{idx}", disabled=(not include))
104
  ratings.append(None if not include else rating)