Spaces:
Sleeping
Sleeping
[Update]Comment line 70-138
Browse files
app.py
CHANGED
@@ -67,75 +67,75 @@ methods = list(set(raw_data['Method']))
|
|
67 |
metrics = ["Chruch","Parachute","Tench","Garbage Turch","Van Gogh","Violence","Illegal Activity","Nudity"]
|
68 |
|
69 |
# Searching and filtering
|
70 |
-
def update_table(
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
):
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
def search_table(df: pd.DataFrame, query: str) -> pd.DataFrame:
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
def filter_queries(query: str, filtered_df: pd.DataFrame) -> pd.DataFrame:
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
def filter_models(
|
121 |
-
|
122 |
-
) -> pd.DataFrame:
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
|
140 |
|
141 |
demo = gr.Blocks(css=custom_css)
|
|
|
67 |
metrics = ["Chruch","Parachute","Tench","Garbage Turch","Van Gogh","Violence","Illegal Activity","Nudity"]
|
68 |
|
69 |
# Searching and filtering
|
70 |
+
# def update_table(
|
71 |
+
# hidden_df: pd.DataFrame,
|
72 |
+
# columns: list,
|
73 |
+
# type_query: list,
|
74 |
+
# precision_query: str,
|
75 |
+
# size_query: list,
|
76 |
+
# show_deleted: bool,
|
77 |
+
# query: str,
|
78 |
+
# ):
|
79 |
+
# filtered_df = filter_models(hidden_df, type_query, size_query, precision_query, show_deleted)
|
80 |
+
# filtered_df = filter_queries(query, filtered_df)
|
81 |
+
# df = select_columns(filtered_df, columns)
|
82 |
+
# return df
|
83 |
+
|
84 |
+
|
85 |
+
# def search_table(df: pd.DataFrame, query: str) -> pd.DataFrame:
|
86 |
+
# return df[(df[AutoEvalColumn.model.name].str.contains(query, case=False))]
|
87 |
+
|
88 |
+
|
89 |
+
# def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
|
90 |
+
# always_here_cols = [
|
91 |
+
# AutoEvalColumn.model_type_symbol.name,
|
92 |
+
# AutoEvalColumn.model.name,
|
93 |
+
# ]
|
94 |
+
# # We use COLS to maintain sorting
|
95 |
+
# filtered_df = df[
|
96 |
+
# always_here_cols + [c for c in COLS if c in df.columns and c in columns]
|
97 |
+
# ]
|
98 |
+
# return filtered_df
|
99 |
+
|
100 |
+
|
101 |
+
# def filter_queries(query: str, filtered_df: pd.DataFrame) -> pd.DataFrame:
|
102 |
+
# final_df = []
|
103 |
+
# if query != "":
|
104 |
+
# queries = [q.strip() for q in query.split(";")]
|
105 |
+
# for _q in queries:
|
106 |
+
# _q = _q.strip()
|
107 |
+
# if _q != "":
|
108 |
+
# temp_filtered_df = search_table(filtered_df, _q)
|
109 |
+
# if len(temp_filtered_df) > 0:
|
110 |
+
# final_df.append(temp_filtered_df)
|
111 |
+
# if len(final_df) > 0:
|
112 |
+
# filtered_df = pd.concat(final_df)
|
113 |
+
# filtered_df = filtered_df.drop_duplicates(
|
114 |
+
# subset=[AutoEvalColumn.model.name, AutoEvalColumn.precision.name, AutoEvalColumn.revision.name]
|
115 |
+
# )
|
116 |
+
|
117 |
+
# return filtered_df
|
118 |
+
|
119 |
+
|
120 |
+
# def filter_models(
|
121 |
+
# df: pd.DataFrame, type_query: list, size_query: list, precision_query: list, show_deleted: bool
|
122 |
+
# ) -> pd.DataFrame:
|
123 |
+
# # Show all models
|
124 |
+
# if show_deleted:
|
125 |
+
# filtered_df = df
|
126 |
+
# else: # Show only still on the hub models
|
127 |
+
# filtered_df = df[df[AutoEvalColumn.still_on_hub.name] == True]
|
128 |
+
|
129 |
+
# type_emoji = [t[0] for t in type_query]
|
130 |
+
# filtered_df = filtered_df.loc[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
|
131 |
+
# filtered_df = filtered_df.loc[df[AutoEvalColumn.precision.name].isin(precision_query + ["None"])]
|
132 |
+
|
133 |
+
# numeric_interval = pd.IntervalIndex(sorted([NUMERIC_INTERVALS[s] for s in size_query]))
|
134 |
+
# params_column = pd.to_numeric(df[AutoEvalColumn.params.name], errors="coerce")
|
135 |
+
# mask = params_column.apply(lambda x: any(numeric_interval.contains(x)))
|
136 |
+
# filtered_df = filtered_df.loc[mask]
|
137 |
+
|
138 |
+
# return filtered_df
|
139 |
|
140 |
|
141 |
demo = gr.Blocks(css=custom_css)
|