Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -90,29 +90,33 @@ with gr.Blocks(title="🤗 ModelVerse Explorer", fill_width=True, css=custom_css
|
|
| 90 |
|
| 91 |
with gr.Row():
|
| 92 |
with gr.Column(scale=1):
|
| 93 |
-
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
tag_filter_dropdown = gr.Dropdown(label="Select Tag", choices=TAG_FILTER_CHOICES, value=None, visible=False)
|
| 96 |
pipeline_filter_dropdown = gr.Dropdown(label="Select Pipeline Tag", choices=PIPELINE_TAGS, value=None, visible=False)
|
| 97 |
|
| 98 |
-
# --- FIX 2: Wrapped the slider and its labels in a Group for consistent styling ---
|
| 99 |
with gr.Group():
|
| 100 |
-
# --- FIX 1: Added a manual label for the slider ---
|
| 101 |
gr.Markdown("<div style='font-weight: 500;'>Model Parameters</div>")
|
| 102 |
param_range_slider = RangeSlider(
|
| 103 |
minimum=0,
|
| 104 |
maximum=len(PARAM_CHOICES) - 1,
|
| 105 |
value=PARAM_CHOICES_DEFAULT_INDICES,
|
| 106 |
step=1,
|
| 107 |
-
label=None,
|
| 108 |
show_label=False,
|
| 109 |
container=False,
|
| 110 |
elem_id="param-slider-wrapper"
|
| 111 |
)
|
| 112 |
param_range_display = gr.Markdown(f"Range: `{PARAM_CHOICES[0]}` to `{PARAM_CHOICES[-1]}`")
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
|
|
|
|
|
|
| 116 |
generate_plot_button = gr.Button(value="Generate Plot", variant="primary", interactive=False)
|
| 117 |
|
| 118 |
with gr.Column(scale=3):
|
|
@@ -129,7 +133,9 @@ with gr.Blocks(title="🤗 ModelVerse Explorer", fill_width=True, css=custom_css
|
|
| 129 |
def _update_button_interactivity(is_loaded_flag): return gr.update(interactive=is_loaded_flag)
|
| 130 |
loading_complete_state.change(fn=_update_button_interactivity, inputs=loading_complete_state, outputs=generate_plot_button)
|
| 131 |
|
| 132 |
-
def _toggle_filters_visibility(choice):
|
|
|
|
|
|
|
| 133 |
filter_choice_radio.change(fn=_toggle_filters_visibility, inputs=filter_choice_radio, outputs=[tag_filter_dropdown, pipeline_filter_dropdown])
|
| 134 |
|
| 135 |
def ui_load_data_controller(progress=gr.Progress()):
|
|
|
|
| 90 |
|
| 91 |
with gr.Row():
|
| 92 |
with gr.Column(scale=1):
|
| 93 |
+
|
| 94 |
+
# --- FINAL FIX: Wrapped all filter sections in Groups for a uniform UI ---
|
| 95 |
+
with gr.Group():
|
| 96 |
+
count_by_dropdown = gr.Dropdown(label="Metric", choices=[("Downloads (last 30 days)", "downloads"), ("Downloads (All Time)", "downloadsAllTime"), ("Likes", "likes")], value="downloads")
|
| 97 |
+
filter_choice_radio = gr.Radio(label="Filter Type", choices=["None", "Tag Filter", "Pipeline Filter"], value="None")
|
| 98 |
+
|
| 99 |
tag_filter_dropdown = gr.Dropdown(label="Select Tag", choices=TAG_FILTER_CHOICES, value=None, visible=False)
|
| 100 |
pipeline_filter_dropdown = gr.Dropdown(label="Select Pipeline Tag", choices=PIPELINE_TAGS, value=None, visible=False)
|
| 101 |
|
|
|
|
| 102 |
with gr.Group():
|
|
|
|
| 103 |
gr.Markdown("<div style='font-weight: 500;'>Model Parameters</div>")
|
| 104 |
param_range_slider = RangeSlider(
|
| 105 |
minimum=0,
|
| 106 |
maximum=len(PARAM_CHOICES) - 1,
|
| 107 |
value=PARAM_CHOICES_DEFAULT_INDICES,
|
| 108 |
step=1,
|
| 109 |
+
label=None,
|
| 110 |
show_label=False,
|
| 111 |
container=False,
|
| 112 |
elem_id="param-slider-wrapper"
|
| 113 |
)
|
| 114 |
param_range_display = gr.Markdown(f"Range: `{PARAM_CHOICES[0]}` to `{PARAM_CHOICES[-1]}`")
|
| 115 |
|
| 116 |
+
with gr.Group():
|
| 117 |
+
top_k_dropdown = gr.Dropdown(label="Number of Top Organizations", choices=TOP_K_CHOICES, value=25)
|
| 118 |
+
skip_orgs_textbox = gr.Textbox(label="Organizations to Skip (comma-separated)", value="TheBloke,MaziyarPanahi,unsloth,modularai,Gensyn,bartowski")
|
| 119 |
+
|
| 120 |
generate_plot_button = gr.Button(value="Generate Plot", variant="primary", interactive=False)
|
| 121 |
|
| 122 |
with gr.Column(scale=3):
|
|
|
|
| 133 |
def _update_button_interactivity(is_loaded_flag): return gr.update(interactive=is_loaded_flag)
|
| 134 |
loading_complete_state.change(fn=_update_button_interactivity, inputs=loading_complete_state, outputs=generate_plot_button)
|
| 135 |
|
| 136 |
+
def _toggle_filters_visibility(choice):
|
| 137 |
+
# The conditional dropdowns should not be in a group, so they appear correctly
|
| 138 |
+
return gr.update(visible=choice == "Tag Filter"), gr.update(visible=choice == "Pipeline Filter")
|
| 139 |
filter_choice_radio.change(fn=_toggle_filters_visibility, inputs=filter_choice_radio, outputs=[tag_filter_dropdown, pipeline_filter_dropdown])
|
| 140 |
|
| 141 |
def ui_load_data_controller(progress=gr.Progress()):
|