Spaces:
Sleeping
Sleeping
File size: 5,041 Bytes
ed881c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
"""Main Gradio application for the Mars Vision Leaderboard."""
import gradio as gr
from .leaderboard import update_leaderboard
from .data import TASK_DATA
import pandas as pd
TASKS = ["Classification", "Object Detection", "Segmentation"]
def get_available_models(task: str) -> list:
"""Get list of available models for a task."""
data, _ = TASK_DATA[task]
return sorted(list(set(data['Model'])))
def create_interface():
"""Create the Gradio interface."""
with gr.Blocks(title="Mars Vision Leaderboard", theme=gr.themes.Default()) as demo:
gr.Markdown(
"""
# Mars Vision Leaderboard
A comprehensive evaluation of computer vision models on Mars-specific datasets.
This leaderboard tracks performance across multiple tasks including classification,
object detection, and segmentation.
"""
)
with gr.Tabs():
with gr.TabItem("π General Datasets"):
with gr.Row():
with gr.Column(scale=1):
gr.Markdown("""
#### Surface Analysis
β’ **Robins & Hynek** - Craters
β’ **Lagain** - Surface Features
β’ **SPOC** - Surface Properties
β’ **AI4MARS** - Surface Analysis
β’ **MarsData** - General Surface
""")
with gr.Column(scale=1):
gr.Markdown("""
#### Classification
β’ **DoMars16k** - Surface Types
β’ **Mars Image** - Content Analysis
β’ **Deep Mars** - Deep Learning
β’ **Dusty vs Non-dusty** - Dust Analysis
""")
with gr.Column(scale=1):
gr.Markdown("""
#### Segmentation
β’ **S5Mars** - Surface
β’ **Mars-Seg** - Features
β’ **Martian Landslide**
β’ **Martian Frost**
""")
with gr.TabItem("π― Specialized Tasks"):
with gr.Row():
with gr.Column(scale=1):
gr.Markdown("""
#### Detection Tasks
β’ **Change Detection**
β’ **Outlier Detection**
β’ **Novelty Detection**
""")
with gr.Column(scale=1):
gr.Markdown("""
#### Feature Analysis
β’ **Cone Detection**
β’ **Dust Devil Tracks**
β’ **Cone Segmentation**
""")
with gr.Row():
task_dropdown = gr.Dropdown(
choices=TASKS,
value=TASKS[0],
label="Select Task",
)
model_multiselect = gr.Dropdown(
choices=get_available_models(TASKS[0]),
value=None,
label="Filter Models (Optional)",
multiselect=True,
)
with gr.Column():
gr.Markdown("### Best Performing Models Across Datasets")
best_models_output = gr.Dataframe(
interactive=False,
wrap=True,
headers=["Metric", "Rank", "Model", "Average Score"],
)
gr.Markdown("### Detailed Results")
table_output = gr.Dataframe(interactive=False, wrap=True)
with gr.Row():
plot_output1 = gr.Plot(label="Performance Plot 1")
plot_output2 = gr.Plot(label="Performance Plot 2")
def update_models(task):
return gr.Dropdown(choices=get_available_models(task))
def update_with_filters(task, models):
return update_leaderboard(task, models)
# Event handlers
task_dropdown.change(
fn=update_models,
inputs=[task_dropdown],
outputs=[model_multiselect],
)
for component in [task_dropdown, model_multiselect]:
component.change(
fn=update_with_filters,
inputs=[task_dropdown, model_multiselect],
outputs=[table_output, plot_output1, plot_output2, best_models_output],
)
# Initial update
demo.load(
fn=update_with_filters,
inputs=[task_dropdown, model_multiselect],
outputs=[table_output, plot_output1, plot_output2, best_models_output],
)
return demo
if __name__ == "__main__":
demo = create_interface()
demo.launch() |