Spaces:
Sleeping
Sleeping
Deploy Space app files
Browse files
app.py
CHANGED
|
@@ -212,24 +212,6 @@ def download_glb(glb_path: str) -> str:
|
|
| 212 |
return str(local)
|
| 213 |
|
| 214 |
|
| 215 |
-
def build_stats_markdown(df: pd.DataFrame, preview_df: pd.DataFrame) -> str:
|
| 216 |
-
"""Generate preview subset overview statistics."""
|
| 217 |
-
total_instances = len(df)
|
| 218 |
-
total_models = df["model_name"].nunique()
|
| 219 |
-
total_frames = len(preview_df)
|
| 220 |
-
main_cats = df["main_category"].dropna().astype(str)
|
| 221 |
-
main_dist = main_cats.value_counts().head(10)
|
| 222 |
-
dist_lines = " | ".join(f"**{cat}**: {cnt}" for cat, cnt in main_dist.items())
|
| 223 |
-
return (
|
| 224 |
-
f"**Preview Subset** — "
|
| 225 |
-
f"**{total_instances}** instances, "
|
| 226 |
-
f"**{total_frames}** frames, "
|
| 227 |
-
f"**{total_models}** models, "
|
| 228 |
-
f"**{main_cats.nunique()}** main categories\n\n"
|
| 229 |
-
f"Distribution: {dist_lines}"
|
| 230 |
-
)
|
| 231 |
-
|
| 232 |
-
|
| 233 |
# ---------------------------------------------------------------------------
|
| 234 |
# App builder
|
| 235 |
# ---------------------------------------------------------------------------
|
|
@@ -238,7 +220,6 @@ def build_app(instance_df: pd.DataFrame, preview_df: pd.DataFrame) -> gr.Blocks:
|
|
| 238 |
model_name_choices = get_distinct_text_choices(instance_df, "model_name")
|
| 239 |
material_name_choices = get_distinct_text_choices(instance_df, "material_name")
|
| 240 |
env_name_choices = get_distinct_text_choices(instance_df, "env_name")
|
| 241 |
-
stats_md = build_stats_markdown(instance_df, preview_df)
|
| 242 |
|
| 243 |
def filtered_instance_rows(
|
| 244 |
model_name: str,
|
|
@@ -320,7 +301,6 @@ def build_app(instance_df: pd.DataFrame, preview_df: pd.DataFrame) -> gr.Blocks:
|
|
| 320 |
gr.Markdown(
|
| 321 |
"Browse the configured preview subset. Select an RGB thumbnail to inspect the instance."
|
| 322 |
)
|
| 323 |
-
gr.Markdown(stats_md)
|
| 324 |
|
| 325 |
with gr.Row():
|
| 326 |
model_name = gr.Dropdown(label="model_name", choices=model_name_choices, value=FILTER_ALL)
|
|
|
|
| 212 |
return str(local)
|
| 213 |
|
| 214 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
# ---------------------------------------------------------------------------
|
| 216 |
# App builder
|
| 217 |
# ---------------------------------------------------------------------------
|
|
|
|
| 220 |
model_name_choices = get_distinct_text_choices(instance_df, "model_name")
|
| 221 |
material_name_choices = get_distinct_text_choices(instance_df, "material_name")
|
| 222 |
env_name_choices = get_distinct_text_choices(instance_df, "env_name")
|
|
|
|
| 223 |
|
| 224 |
def filtered_instance_rows(
|
| 225 |
model_name: str,
|
|
|
|
| 301 |
gr.Markdown(
|
| 302 |
"Browse the configured preview subset. Select an RGB thumbnail to inspect the instance."
|
| 303 |
)
|
|
|
|
| 304 |
|
| 305 |
with gr.Row():
|
| 306 |
model_name = gr.Dropdown(label="model_name", choices=model_name_choices, value=FILTER_ALL)
|