ubowang commited on
Commit
8475b2f
·
verified ·
1 Parent(s): 1f5abbf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -8
app.py CHANGED
@@ -3,9 +3,9 @@ from utils import *
3
  global data_component
4
 
5
 
6
- def update_table(query):
7
  df = get_df()
8
- filtered_df = search_models(df, query)
9
  return filtered_df
10
 
11
 
@@ -28,11 +28,23 @@ with gr.Blocks() as block:
28
  TABLE_INTRODUCTION
29
  )
30
 
31
- search_bar = gr.Textbox(
32
- placeholder="Search models...",
33
- show_label=False,
34
- elem_id="search-bar"
35
- )
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  data_component = gr.components.Dataframe(
38
  value=get_df(),
@@ -44,8 +56,11 @@ with gr.Blocks() as block:
44
  height=1000
45
  )
46
  refresh_button = gr.Button("Refresh")
47
- search_bar.change(fn=update_table, inputs=[search_bar], outputs=data_component)
 
48
  refresh_button.click(fn=refresh_data, outputs=data_component)
 
 
49
 
50
  # table 2
51
  with gr.TabItem("📝 About", elem_id="qa-tab-table2", id=2):
 
3
  global data_component
4
 
5
 
6
+ def update_table(query, min_size, max_size):
7
  df = get_df()
8
+ filtered_df = search_and_filter_models(df, query, min_size, max_size)
9
  return filtered_df
10
 
11
 
 
28
  TABLE_INTRODUCTION
29
  )
30
 
31
+ with gr.Row():
32
+ search_bar = gr.Textbox(
33
+ placeholder="Search models...",
34
+ show_label=False,
35
+ elem_id="search-bar"
36
+ )
37
+ df = get_df()
38
+ min_size, max_size = get_size_range(df)
39
+
40
+ with gr.Row():
41
+ size_slider = gr.RangeSlider(
42
+ minimum=min_size,
43
+ maximum=max_size,
44
+ value=[min_size, max_size],
45
+ step=0.1,
46
+ label="Select the number of parameters (B)",
47
+ )
48
 
49
  data_component = gr.components.Dataframe(
50
  value=get_df(),
 
56
  height=1000
57
  )
58
  refresh_button = gr.Button("Refresh")
59
+ search_bar.change(fn=update_table, inputs=[search_bar, size_slider], outputs=data_component)
60
+ size_slider.change(fn=update_table, inputs=[search_bar, size_slider], outputs=data_component)
61
  refresh_button.click(fn=refresh_data, outputs=data_component)
62
+ # search_bar.change(fn=update_table, inputs=[search_bar], outputs=data_component)
63
+ # refresh_button.click(fn=refresh_data, outputs=data_component)
64
 
65
  # table 2
66
  with gr.TabItem("📝 About", elem_id="qa-tab-table2", id=2):