Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,6 @@ from gradio_rangeslider import RangeSlider
|
|
10 |
|
11 |
# --- Constants ---
|
12 |
PARAM_CHOICES = ['< 1B', '1B', '5B', '12B', '32B', '64B', '128B', '256B', '> 500B']
|
13 |
-
# The RangeSlider component uses a tuple for its default value
|
14 |
PARAM_CHOICES_DEFAULT_INDICES = (0, len(PARAM_CHOICES) - 1)
|
15 |
|
16 |
TOP_K_CHOICES = list(range(5, 51, 5))
|
@@ -78,7 +77,14 @@ def create_treemap(treemap_data, count_by, title=None):
|
|
78 |
fig.update_traces(textinfo="label+value+percent root", hovertemplate="<b>%{label}</b><br>%{value:,} " + count_by + "<br>%{percentRoot:.2%} of total<extra></extra>")
|
79 |
return fig
|
80 |
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
models_data_state = gr.State(pd.DataFrame())
|
83 |
loading_complete_state = gr.State(False)
|
84 |
|
@@ -92,20 +98,18 @@ with gr.Blocks(title="🤗 ModelVerse Explorer", fill_width=True) as demo:
|
|
92 |
tag_filter_dropdown = gr.Dropdown(label="Select Tag", choices=TAG_FILTER_CHOICES, value=None, visible=False)
|
93 |
pipeline_filter_dropdown = gr.Dropdown(label="Select Pipeline Tag", choices=PIPELINE_TAGS, value=None, visible=False)
|
94 |
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
)
|
108 |
-
param_range_display = gr.Markdown(f"Range: `{PARAM_CHOICES[0]}` to `{PARAM_CHOICES[-1]}`")
|
109 |
|
110 |
top_k_dropdown = gr.Dropdown(label="Number of Top Organizations", choices=TOP_K_CHOICES, value=25)
|
111 |
skip_orgs_textbox = gr.Textbox(label="Organizations to Skip (comma-separated)", value="TheBloke,MaziyarPanahi,unsloth,modularai,Gensyn,bartowski")
|
@@ -116,22 +120,11 @@ with gr.Blocks(title="🤗 ModelVerse Explorer", fill_width=True) as demo:
|
|
116 |
status_message_md = gr.Markdown("Initializing...")
|
117 |
data_info_md = gr.Markdown("")
|
118 |
|
119 |
-
def
|
120 |
min_idx, max_idx = int(value[0]), int(value[1])
|
121 |
-
|
122 |
-
|
123 |
-
display_text = f"Range: `{PARAM_CHOICES[min_idx]}` to `{PARAM_CHOICES[max_idx]}`"
|
124 |
-
button_visibility = gr.update(visible=not is_default)
|
125 |
-
|
126 |
-
return display_text, button_visibility
|
127 |
|
128 |
-
param_range_slider.change(
|
129 |
-
|
130 |
-
def reset_params():
|
131 |
-
default_text = f"Range: `{PARAM_CHOICES[0]}` to `{PARAM_CHOICES[-1]}`"
|
132 |
-
return PARAM_CHOICES_DEFAULT_INDICES, default_text, gr.update(visible=False)
|
133 |
-
|
134 |
-
reset_params_button.click(reset_params, outputs=[param_range_slider, param_range_display, reset_params_button])
|
135 |
|
136 |
def _update_button_interactivity(is_loaded_flag): return gr.update(interactive=is_loaded_flag)
|
137 |
loading_complete_state.change(fn=_update_button_interactivity, inputs=loading_complete_state, outputs=generate_plot_button)
|
|
|
10 |
|
11 |
# --- Constants ---
|
12 |
PARAM_CHOICES = ['< 1B', '1B', '5B', '12B', '32B', '64B', '128B', '256B', '> 500B']
|
|
|
13 |
PARAM_CHOICES_DEFAULT_INDICES = (0, len(PARAM_CHOICES) - 1)
|
14 |
|
15 |
TOP_K_CHOICES = list(range(5, 51, 5))
|
|
|
77 |
fig.update_traces(textinfo="label+value+percent root", hovertemplate="<b>%{label}</b><br>%{value:,} " + count_by + "<br>%{percentRoot:.2%} of total<extra></extra>")
|
78 |
return fig
|
79 |
|
80 |
+
# --- FIX 2: CSS to hide the numerical input box of the RangeSlider component ---
|
81 |
+
custom_css = """
|
82 |
+
#param-slider-wrapper > .svelte-z615s1 {
|
83 |
+
display: none !important;
|
84 |
+
}
|
85 |
+
"""
|
86 |
+
|
87 |
+
with gr.Blocks(title="🤗 ModelVerse Explorer", fill_width=True, css=custom_css) as demo:
|
88 |
models_data_state = gr.State(pd.DataFrame())
|
89 |
loading_complete_state = gr.State(False)
|
90 |
|
|
|
98 |
tag_filter_dropdown = gr.Dropdown(label="Select Tag", choices=TAG_FILTER_CHOICES, value=None, visible=False)
|
99 |
pipeline_filter_dropdown = gr.Dropdown(label="Select Pipeline Tag", choices=PIPELINE_TAGS, value=None, visible=False)
|
100 |
|
101 |
+
# The elem_id is used by our custom CSS to target *only* this slider
|
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="Parameters",
|
108 |
+
# --- FIX 1: Remove the grey container ---
|
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 |
top_k_dropdown = gr.Dropdown(label="Number of Top Organizations", choices=TOP_K_CHOICES, value=25)
|
115 |
skip_orgs_textbox = gr.Textbox(label="Organizations to Skip (comma-separated)", value="TheBloke,MaziyarPanahi,unsloth,modularai,Gensyn,bartowski")
|
|
|
120 |
status_message_md = gr.Markdown("Initializing...")
|
121 |
data_info_md = gr.Markdown("")
|
122 |
|
123 |
+
def update_param_display(value: tuple):
|
124 |
min_idx, max_idx = int(value[0]), int(value[1])
|
125 |
+
return f"Range: `{PARAM_CHOICES[min_idx]}` to `{PARAM_CHOICES[max_idx]}`"
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
+
param_range_slider.change(update_param_display, param_range_slider, param_range_display)
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
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)
|