evijit HF Staff commited on
Commit
9062ccf
·
verified ·
1 Parent(s): 57b85cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -10
app.py CHANGED
@@ -77,8 +77,19 @@ def create_treemap(treemap_data, count_by, title=None):
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
  custom_css = """
81
- #param-slider-wrapper .tab-like-container { display: none !important; }
 
 
 
 
 
 
 
 
 
 
82
  """
83
 
84
  with gr.Blocks(title="🤗 ModelVerse Explorer", fill_width=True, css=custom_css) as demo:
@@ -91,14 +102,14 @@ with gr.Blocks(title="🤗 ModelVerse Explorer", fill_width=True, css=custom_css
91
  with gr.Row():
92
  with gr.Column(scale=1):
93
 
94
- # --- FINAL FIX: Each logical section is now in its own Group for consistent styling ---
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(
@@ -108,14 +119,13 @@ with gr.Blocks(title="🤗 ModelVerse Explorer", fill_width=True, css=custom_css
108
  step=1,
109
  label=None,
110
  show_label=False,
111
- container=False, # This is crucial to let the parent Group control the style
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
 
 
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
+ # --- FINAL FIX: Use CSS to target and fix the specific visual issues ---
81
  custom_css = """
82
+ /* Target the specific gr.Group containing the slider and remove its background/border */
83
+ .gradio-group:has(#param-slider-wrapper) {
84
+ border: none !important;
85
+ background: none !important;
86
+ box-shadow: none !important;
87
+ padding: 0 !important; /* Also remove padding to align with other elements */
88
+ }
89
+ /* Target the min/max number labels within the RangeSlider component and hide them */
90
+ #param-slider-wrapper div[data-testid="range-slider"] > span {
91
+ display: none !important;
92
+ }
93
  """
94
 
95
  with gr.Blocks(title="🤗 ModelVerse Explorer", fill_width=True, css=custom_css) as demo:
 
102
  with gr.Row():
103
  with gr.Column(scale=1):
104
 
105
+ # This section remains un-grouped for a consistent flat look
106
+ count_by_dropdown = gr.Dropdown(label="Metric", choices=[("Downloads (last 30 days)", "downloads"), ("Downloads (All Time)", "downloadsAllTime"), ("Likes", "likes")], value="downloads")
107
+ filter_choice_radio = gr.Radio(label="Filter Type", choices=["None", "Tag Filter", "Pipeline Filter"], value="None")
 
108
 
109
  tag_filter_dropdown = gr.Dropdown(label="Select Tag", choices=TAG_FILTER_CHOICES, value=None, visible=False)
110
  pipeline_filter_dropdown = gr.Dropdown(label="Select Pipeline Tag", choices=PIPELINE_TAGS, value=None, visible=False)
111
 
112
+ # This group's styling will be removed by the custom CSS
113
  with gr.Group():
114
  gr.Markdown("<div style='font-weight: 500;'>Model Parameters</div>")
115
  param_range_slider = RangeSlider(
 
119
  step=1,
120
  label=None,
121
  show_label=False,
 
122
  elem_id="param-slider-wrapper"
123
  )
124
  param_range_display = gr.Markdown(f"Range: `{PARAM_CHOICES[0]}` to `{PARAM_CHOICES[-1]}`")
125
+
126
+ # This section remains un-grouped
127
+ top_k_dropdown = gr.Dropdown(label="Number of Top Organizations", choices=TOP_K_CHOICES, value=25)
128
+ skip_orgs_textbox = gr.Textbox(label="Organizations to Skip (comma-separated)", value="TheBloke,MaziyarPanahi,unsloth,modularai,Gensyn,bartowski")
129
 
130
  generate_plot_button = gr.Button(value="Generate Plot", variant="primary", interactive=False)
131