Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -83,8 +83,8 @@ def calculate_score(*ratings):
|
|
| 83 |
if not valid:
|
| 84 |
return "<h2 style='text-align:center;'>Please rate at least one criterion.</h2>"
|
| 85 |
avg = sum(valid) / len(valid)
|
| 86 |
-
|
| 87 |
-
scaled_score = (1/18) * (avg ** 2) + (19/18) * avg - (1/9)
|
| 88 |
return f"<h2 style='text-align:center;'>Final Scaled Score: {scaled_score:.2f} / 10</h2>"
|
| 89 |
|
| 90 |
with gr.Blocks(css=css, title="Movie Rating System") as demo:
|
|
@@ -94,10 +94,10 @@ with gr.Blocks(css=css, title="Movie Rating System") as demo:
|
|
| 94 |
for group, subcriteria in criteria.items():
|
| 95 |
gr.HTML(f"<div class='category-header'>{group}</div>")
|
| 96 |
for crit in subcriteria:
|
| 97 |
-
with gr.
|
| 98 |
gr.HTML(f"<div class='criteria-name'>{crit['name']}</div>")
|
| 99 |
gr.HTML(f"<div class='criteria-description'>{crit['description']}</div>")
|
| 100 |
-
#
|
| 101 |
rating = gr.Rating(num_stars=7, value=0, label="")
|
| 102 |
rating_components.append(rating)
|
| 103 |
|
|
|
|
| 83 |
if not valid:
|
| 84 |
return "<h2 style='text-align:center;'>Please rate at least one criterion.</h2>"
|
| 85 |
avg = sum(valid) / len(valid)
|
| 86 |
+
|
| 87 |
+
scaled_score = (1/18) * (avg ** 2) + (19/18) * avg - (1/9)
|
| 88 |
return f"<h2 style='text-align:center;'>Final Scaled Score: {scaled_score:.2f} / 10</h2>"
|
| 89 |
|
| 90 |
with gr.Blocks(css=css, title="Movie Rating System") as demo:
|
|
|
|
| 94 |
for group, subcriteria in criteria.items():
|
| 95 |
gr.HTML(f"<div class='category-header'>{group}</div>")
|
| 96 |
for crit in subcriteria:
|
| 97 |
+
with gr.Column(elem_classes="subcriteria"):
|
| 98 |
gr.HTML(f"<div class='criteria-name'>{crit['name']}</div>")
|
| 99 |
gr.HTML(f"<div class='criteria-description'>{crit['description']}</div>")
|
| 100 |
+
# Star rating component (0 means not rated)
|
| 101 |
rating = gr.Rating(num_stars=7, value=0, label="")
|
| 102 |
rating_components.append(rating)
|
| 103 |
|