Spaces:
Runtime error
Runtime error
Update model_list.py
Browse files- model_list.py +10 -2
model_list.py
CHANGED
@@ -17,6 +17,7 @@ class ModelList:
|
|
17 |
<tr>
|
18 |
<td width="20%">Model Name</td>
|
19 |
<td width="10%">Type</td>
|
|
|
20 |
<td width="10%">Paper</td>
|
21 |
<td width="10%">Code on Github</td>
|
22 |
<td width="10%">Weights on 🤗</td>
|
@@ -37,13 +38,16 @@ class ModelList:
|
|
37 |
other_model = f'<a href="{row.other}" target="_blank">Other Weights</a>' if isinstance(
|
38 |
row.other, str) else ''
|
39 |
data_type = f'{row.data_type}' if isinstance(
|
40 |
-
row.
|
41 |
base_model = f'{row.base_model}' if isinstance(
|
42 |
-
row.
|
|
|
|
|
43 |
row = f'''
|
44 |
<tr>
|
45 |
<td>{row.name}</td>
|
46 |
<td>{data_type}</td>
|
|
|
47 |
<td>{paper}</td>
|
48 |
<td>{github}</td>
|
49 |
<td>{hf_model}</td>
|
@@ -56,6 +60,7 @@ class ModelList:
|
|
56 |
case_sensitive: bool,
|
57 |
filter_names: list[str],
|
58 |
data_types: list[str],
|
|
|
59 |
#model_types: list[str]
|
60 |
) -> tuple[int, str]:
|
61 |
df = self.table
|
@@ -68,6 +73,7 @@ class ModelList:
|
|
68 |
has_github = 'Code' in filter_names
|
69 |
has_model = 'Model Weights' in filter_names
|
70 |
df = self.filter_table(df, has_paper, has_github, has_model, data_types)
|
|
|
71 |
#df = self.filter_table(df, has_paper, has_github, has_model, data_types, model_types)
|
72 |
return len(df), self.to_html(df, self.table_header)
|
73 |
|
@@ -75,6 +81,7 @@ class ModelList:
|
|
75 |
def filter_table(df: pd.DataFrame, has_paper: bool, has_github: bool,
|
76 |
has_model: bool,
|
77 |
data_types: list[str],
|
|
|
78 |
#model_types: list[str]
|
79 |
) -> pd.DataFrame:
|
80 |
if has_paper:
|
@@ -85,6 +92,7 @@ class ModelList:
|
|
85 |
df = df[~df.hub.isna() | ~df.other.isna()]
|
86 |
df = df[df.data_type.isin(set(data_types))]
|
87 |
#df = df[df.base_model.isin(set(model_types))]
|
|
|
88 |
return df
|
89 |
|
90 |
@staticmethod
|
|
|
17 |
<tr>
|
18 |
<td width="20%">Model Name</td>
|
19 |
<td width="10%">Type</td>
|
20 |
+
<td width="10%">Year</td>
|
21 |
<td width="10%">Paper</td>
|
22 |
<td width="10%">Code on Github</td>
|
23 |
<td width="10%">Weights on 🤗</td>
|
|
|
38 |
other_model = f'<a href="{row.other}" target="_blank">Other Weights</a>' if isinstance(
|
39 |
row.other, str) else ''
|
40 |
data_type = f'{row.data_type}' if isinstance(
|
41 |
+
row.data_type, str) else ''
|
42 |
base_model = f'{row.base_model}' if isinstance(
|
43 |
+
row.base_model, str) else ''
|
44 |
+
year = f'{row.year}' if isinstance(
|
45 |
+
row.year, str) else ''
|
46 |
row = f'''
|
47 |
<tr>
|
48 |
<td>{row.name}</td>
|
49 |
<td>{data_type}</td>
|
50 |
+
<td>{year}</td>
|
51 |
<td>{paper}</td>
|
52 |
<td>{github}</td>
|
53 |
<td>{hf_model}</td>
|
|
|
60 |
case_sensitive: bool,
|
61 |
filter_names: list[str],
|
62 |
data_types: list[str],
|
63 |
+
years: list[str],
|
64 |
#model_types: list[str]
|
65 |
) -> tuple[int, str]:
|
66 |
df = self.table
|
|
|
73 |
has_github = 'Code' in filter_names
|
74 |
has_model = 'Model Weights' in filter_names
|
75 |
df = self.filter_table(df, has_paper, has_github, has_model, data_types)
|
76 |
+
df = self.filter_table(df, has_paper, has_github, has_model, data_types, years)
|
77 |
#df = self.filter_table(df, has_paper, has_github, has_model, data_types, model_types)
|
78 |
return len(df), self.to_html(df, self.table_header)
|
79 |
|
|
|
81 |
def filter_table(df: pd.DataFrame, has_paper: bool, has_github: bool,
|
82 |
has_model: bool,
|
83 |
data_types: list[str],
|
84 |
+
years: list[str],
|
85 |
#model_types: list[str]
|
86 |
) -> pd.DataFrame:
|
87 |
if has_paper:
|
|
|
92 |
df = df[~df.hub.isna() | ~df.other.isna()]
|
93 |
df = df[df.data_type.isin(set(data_types))]
|
94 |
#df = df[df.base_model.isin(set(model_types))]
|
95 |
+
df = df[df.base_model.isin(set(years))]
|
96 |
return df
|
97 |
|
98 |
@staticmethod
|