|
|
import gradio as gr |
|
|
import pandas as pd |
|
|
import requests |
|
|
import io |
|
|
from datetime import datetime |
|
|
|
|
|
|
|
|
CSV_URL = "https://docs.google.com/spreadsheets/d/e/2PACX-1vR66Wy-eHXPDCEFksh3SD4SzIFeB7pnmNFHBDkGtrkSFliy6Ef6vdyijfFP-FCuBkqWwXy7qQYRIvCM/pub?gid=0&single=true&output=csv" |
|
|
|
|
|
def fetch_leaderboard_data(): |
|
|
try: |
|
|
response = requests.get(CSV_URL) |
|
|
response.raise_for_status() |
|
|
data = pd.read_csv(io.StringIO(response.text)) |
|
|
|
|
|
|
|
|
data.columns = data.columns.str.strip().str.lower() |
|
|
|
|
|
|
|
|
if 'rank' in data.columns: |
|
|
data['rank'] = pd.to_numeric(data['rank'], errors='coerce') |
|
|
|
|
|
|
|
|
if 'date and time' in data.columns: |
|
|
data['date and time'] = pd.to_datetime(data['date and time'], errors='coerce') |
|
|
|
|
|
|
|
|
data = data.sort_values(by='rank', ascending=True) |
|
|
|
|
|
|
|
|
data.columns = data.columns.str.title() |
|
|
|
|
|
return data |
|
|
|
|
|
except Exception as e: |
|
|
print(f"Error fetching data: {e}") |
|
|
return pd.DataFrame({"Error": ["Unable to fetch data"]}) |
|
|
|
|
|
|
|
|
|
|
|
title = """ |
|
|
<center> |
|
|
<h1> IEEE Low-Power Computer Vision Challenge </h1> |
|
|
<b> 2025 CVPR WORKSHOP </b> |
|
|
</center> |
|
|
""" |
|
|
|
|
|
description = """ |
|
|
<p><b>Important:</b> The leaderboard only shows results from <b>registered teams</b>. Only the <b>last submission</b> from each team in the <b>previous day</b> will be evaluated.</p> |
|
|
<p>Can't find your submission? Check <a href="https://szz1-failed-jobs.hf.space">Failed Jobs</a>.</p> |
|
|
""" |
|
|
|
|
|
|
|
|
def create_gradio_app(): |
|
|
with gr.Blocks(theme="gradio/soft") as app: |
|
|
|
|
|
gr.HTML(description) |
|
|
|
|
|
with gr.Column(): |
|
|
refresh_button = gr.Button("Refresh Leaderboard") |
|
|
leaderboard = gr.DataFrame( |
|
|
value=fetch_leaderboard_data(), |
|
|
interactive=False, |
|
|
label="Leaderboard", |
|
|
) |
|
|
|
|
|
refresh_button.click(lambda: fetch_leaderboard_data(), outputs=leaderboard) |
|
|
return app |
|
|
|
|
|
|
|
|
def run_gradio_app(): |
|
|
app = create_gradio_app() |
|
|
app.launch(server_name="0.0.0.0", server_port=7860, share=True) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
run_gradio_app() |