Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -7,8 +7,6 @@ import tempfile
|
|
7 |
|
8 |
from constants import *
|
9 |
from huggingface_hub import Repository
|
10 |
-
print(gr.__version__)
|
11 |
-
print(pd.__version__)
|
12 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
13 |
|
14 |
global data_component, filter_component
|
@@ -90,6 +88,28 @@ def get_all_df():
|
|
90 |
df = df.sort_values(by="Avg", ascending=False)
|
91 |
return df
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
block = gr.Blocks()
|
95 |
|
@@ -128,29 +148,7 @@ with block:
|
|
128 |
interactive=False,
|
129 |
visible=True,
|
130 |
)
|
131 |
-
|
132 |
-
def on_filter_model_size_method_change(selected_columns):
|
133 |
-
updated_data = get_all_df()
|
134 |
-
|
135 |
-
# columns:
|
136 |
-
selected_columns = [item for item in TASK_INFO if item in selected_columns]
|
137 |
-
present_columns = MODEL_INFO + selected_columns
|
138 |
-
print("selected_columns",'|'.join(selected_columns))
|
139 |
-
updated_data = updated_data[present_columns]
|
140 |
-
updated_data = updated_data.sort_values(by=selected_columns[0], ascending=False)
|
141 |
-
updated_headers = present_columns
|
142 |
-
update_datatype = [DATA_TITILE_TYPE[COLUMN_NAMES.index(x)] for x in updated_headers]
|
143 |
-
|
144 |
-
filter_component = gr.components.Dataframe(
|
145 |
-
value=updated_data,
|
146 |
-
headers=updated_headers,
|
147 |
-
type="pandas",
|
148 |
-
datatype=update_datatype,
|
149 |
-
interactive=False,
|
150 |
-
visible=True,
|
151 |
-
)
|
152 |
-
|
153 |
-
return filter_component.value
|
154 |
|
155 |
checkbox_group.change(fn=on_filter_model_size_method_change, inputs=[ checkbox_group], outputs=data_component)
|
156 |
|
|
|
7 |
|
8 |
from constants import *
|
9 |
from huggingface_hub import Repository
|
|
|
|
|
10 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
11 |
|
12 |
global data_component, filter_component
|
|
|
88 |
df = df.sort_values(by="Avg", ascending=False)
|
89 |
return df
|
90 |
|
91 |
+
def on_filter_model_size_method_change(selected_columns):
|
92 |
+
updated_data = get_all_df()
|
93 |
+
|
94 |
+
# columns:
|
95 |
+
selected_columns = [item for item in TASK_INFO if item in selected_columns]
|
96 |
+
present_columns = MODEL_INFO + selected_columns
|
97 |
+
print("selected_columns",'|'.join(selected_columns))
|
98 |
+
updated_data = updated_data[present_columns]
|
99 |
+
updated_data = updated_data.sort_values(by=selected_columns[0], ascending=False)
|
100 |
+
updated_headers = present_columns
|
101 |
+
update_datatype = [DATA_TITILE_TYPE[COLUMN_NAMES.index(x)] for x in updated_headers]
|
102 |
+
print(updated_data,present_columns,update_datatype)
|
103 |
+
filter_component = gr.components.Dataframe(
|
104 |
+
value=updated_data,
|
105 |
+
headers=updated_headers,
|
106 |
+
type="pandas",
|
107 |
+
datatype=update_datatype,
|
108 |
+
interactive=False,
|
109 |
+
visible=True,
|
110 |
+
)
|
111 |
+
|
112 |
+
return filter_component.value
|
113 |
|
114 |
block = gr.Blocks()
|
115 |
|
|
|
148 |
interactive=False,
|
149 |
visible=True,
|
150 |
)
|
151 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
checkbox_group.change(fn=on_filter_model_size_method_change, inputs=[ checkbox_group], outputs=data_component)
|
154 |
|