Update app.py
Browse files
app.py
CHANGED
|
@@ -785,40 +785,29 @@ with gr.Blocks(css=css_tech_theme) as demo:
|
|
| 785 |
eval_button = gr.Button("π Evaluate",scale=1,min_width=1200)
|
| 786 |
submit_button = gr.Button("π€ Prove and Submit to Leaderboard", elem_id="evaluation-status", visible=False,scale=1,min_width=1200)
|
| 787 |
eval_status = gr.Textbox(label="π οΈ Evaluation Status", interactive=False,scale=1,min_width=1200)
|
| 788 |
-
|
| 789 |
-
# Define the functions outside the `with` block
|
| 790 |
-
# def handle_evaluation(file, model_name):
|
| 791 |
-
# # Check if required inputs are provided
|
| 792 |
-
# if not file:
|
| 793 |
-
# return "Error: Please upload a prediction file.", 0, gr.update(visible=False)
|
| 794 |
-
# if not model_name or model_name.strip() == "":
|
| 795 |
-
# return "Error: Please enter a model name.", 0, gr.update(visible=False)
|
| 796 |
-
|
| 797 |
-
# try:
|
| 798 |
-
# # Load predictions file
|
| 799 |
-
# predictions_df = pd.read_csv(file.name)
|
| 800 |
-
|
| 801 |
-
# # Validate required columns in the prediction file
|
| 802 |
-
# required_columns = ['question_id', 'predicted_answer']
|
| 803 |
-
# missing_columns = [col for col in required_columns if col not in predictions_df.columns]
|
| 804 |
-
# if missing_columns:
|
| 805 |
-
# return (f"Error: Missing required columns in prediction file: {', '.join(missing_columns)}.",
|
| 806 |
-
# 0, gr.update(visible=False))
|
| 807 |
-
|
| 808 |
-
# # Perform evaluation
|
| 809 |
-
# status, leaderboard = evaluate_predictions(file, model_name, add_to_leaderboard=False)
|
| 810 |
-
# if leaderboard.empty:
|
| 811 |
-
# overall_accuracy = 0
|
| 812 |
-
# else:
|
| 813 |
-
# overall_accuracy = leaderboard.iloc[-1]["Overall Accuracy"]
|
| 814 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 815 |
|
| 816 |
-
|
| 817 |
-
|
|
|
|
|
|
|
| 818 |
|
| 819 |
-
|
| 820 |
-
# # Handle unexpected errors
|
| 821 |
-
# return f"Error during evaluation: {str(e)}", 0, gr.update(visible=False)
|
| 822 |
|
| 823 |
def handle_evaluation(file, model_name, Team_name):
|
| 824 |
if not file:
|
|
|
|
| 785 |
eval_button = gr.Button("π Evaluate",scale=1,min_width=1200)
|
| 786 |
submit_button = gr.Button("π€ Prove and Submit to Leaderboard", elem_id="evaluation-status", visible=False,scale=1,min_width=1200)
|
| 787 |
eval_status = gr.Textbox(label="π οΈ Evaluation Status", interactive=False,scale=1,min_width=1200)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 788 |
|
| 789 |
+
|
| 790 |
+
with gr.TabItem("π€ Submission-Pro"):
|
| 791 |
+
gr.Markdown("""
|
| 792 |
+
<div class="submission-section" style="border: 3px solid #6a1b9a; padding: 20px; border-radius: 12px; box-shadow: 0 4px 10px rgba(106, 27, 154, 0.2);">
|
| 793 |
+
<h2 style="color: #6a1b9a; text-align: center;">Submit Your Predictions</h2>
|
| 794 |
+
<p style="font-size: 1.2em; color: #333; text-align: center;">Upload your prediction file and provide your model name to evaluate and optionally submit your results to the leaderboard.</p>
|
| 795 |
+
</div>
|
| 796 |
+
""")
|
| 797 |
+
with gr.Row(elem_id="submission-fields"):
|
| 798 |
+
file_input = gr.File(label="π Upload Prediction CSV for Mobile-MMLU-Pro", file_types=[".csv"], interactive=True,scale=1, min_width=12000)
|
| 799 |
+
model_name_input = gr.Textbox(label="π·οΈ Model Name", placeholder="Enter your model name",scale=1, min_width=800)
|
| 800 |
+
Team_name_input = gr.Textbox(label="π·οΈ Team Name", placeholder="Enter your Team name",scale=1, min_width=800)
|
| 801 |
+
|
| 802 |
+
with gr.Row(elem_id="submission-results"):
|
| 803 |
+
overall_accuracy_display = gr.Number(label="π Overall Accuracy (%)", interactive=False,scale=1,min_width=1200)
|
| 804 |
|
| 805 |
+
with gr.Row(elem_id="submission-buttons"):
|
| 806 |
+
eval_button = gr.Button("π Evaluate",scale=1,min_width=1200)
|
| 807 |
+
submit_button = gr.Button("π€ Prove and Submit to Leaderboard", elem_id="evaluation-status", visible=False,scale=1,min_width=1200)
|
| 808 |
+
eval_status = gr.Textbox(label="π οΈ Evaluation Status", interactive=False,scale=1,min_width=1200)
|
| 809 |
|
| 810 |
+
|
|
|
|
|
|
|
| 811 |
|
| 812 |
def handle_evaluation(file, model_name, Team_name):
|
| 813 |
if not file:
|