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