Add voting feedback
Browse files
app.py
CHANGED
@@ -299,6 +299,17 @@ def gradio_interface():
|
|
299 |
}
|
300 |
logging.debug(vote_data)
|
301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
try:
|
303 |
logging.debug("Adding vote data to the database: %s", vote_data)
|
304 |
result = add_vote(vote_data)
|
|
|
299 |
}
|
300 |
logging.debug(vote_data)
|
301 |
|
302 |
+
# Create a gr.Info message with model names and the user's choice
|
303 |
+
voted_model = vote_data[vote_data["winner"]] if vote_data["winner"] in ["model_a", "model_b"] else "Tie"
|
304 |
+
voted_model_emoji = "👈" if choice == "model_a" else "👉" if choice == "model_b" else "🤝"
|
305 |
+
voted_model_color = "green" if choice == "model_a" else "blue" if choice == "model_b" else "gray"
|
306 |
+
info_message = (
|
307 |
+
f"<p>You voted for <strong style='color:{voted_model_color};'>{voted_model_emoji} {voted_model}</strong>.</p>"
|
308 |
+
f"<p><span style='color:green;'>👈 {model_a_name.value}</span> - "
|
309 |
+
f"<span style='color:blue;'>👉 {model_b_name.value}</span></p>"
|
310 |
+
)
|
311 |
+
gr.Info(info_message)
|
312 |
+
|
313 |
try:
|
314 |
logging.debug("Adding vote data to the database: %s", vote_data)
|
315 |
result = add_vote(vote_data)
|