Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,8 @@ class DataList:
|
|
40 |
|
41 |
def render(self, search_query: str,
|
42 |
filter_names: list[str],
|
43 |
-
filter_names2: list[str]
|
|
|
44 |
) -> tuple[int, str]:
|
45 |
self.table = pd.read_csv(csv_url)
|
46 |
self._preprocess_table()
|
@@ -56,13 +57,14 @@ class DataList:
|
|
56 |
df = self.table
|
57 |
if search_query:
|
58 |
df = df[df.name_lowercase.str.contains(search_query.lower())]
|
59 |
-
df = self.filter_table(df, filter_names,filter_names2)
|
60 |
result = self.to_html(df, self.table_header)
|
61 |
return result
|
62 |
|
63 |
@staticmethod
|
64 |
-
def filter_table(df: pd.DataFrame, filter_names: list[str], filter_names2: list[str]) -> pd.DataFrame:
|
65 |
df = df.loc[df.Type.isin(set(filter_names))]
|
|
|
66 |
return df
|
67 |
|
68 |
@staticmethod
|
@@ -100,16 +102,19 @@ span.svelte-s1r2yt{font-weight: bold !important;
|
|
100 |
"""
|
101 |
with gr.Blocks(css=css) as demo:
|
102 |
search_box = gr.Textbox( label='Search Name', placeholder='You can search for titles with regular expressions. e.g. (?<!sur)face',max_lines=1, scale = 5)
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
105 |
search_button = gr.Button('Search', size = 'sm', scale =1)
|
106 |
|
107 |
with gr.Row():
|
108 |
table = gr.HTML(show_label=False)
|
109 |
|
110 |
-
demo.load(fn=data_list.render, inputs=[search_box, filter_names,filter_names2,],outputs=[table,])
|
111 |
-
search_box.submit(fn=data_list.render, inputs=[search_box, filter_names,filter_names2,], outputs=[table,])
|
112 |
-
search_button.click(fn=data_list.render, inputs=[search_box, filter_names,filter_names2,], outputs=[table,])
|
113 |
|
114 |
demo.queue()
|
115 |
demo.launch(share=False)
|
|
|
40 |
|
41 |
def render(self, search_query: str,
|
42 |
filter_names: list[str],
|
43 |
+
filter_names2: list[str],
|
44 |
+
filter_names3: list[str]
|
45 |
) -> tuple[int, str]:
|
46 |
self.table = pd.read_csv(csv_url)
|
47 |
self._preprocess_table()
|
|
|
57 |
df = self.table
|
58 |
if search_query:
|
59 |
df = df[df.name_lowercase.str.contains(search_query.lower())]
|
60 |
+
df = self.filter_table(df, filter_names,filter_names2,filter_names3)
|
61 |
result = self.to_html(df, self.table_header)
|
62 |
return result
|
63 |
|
64 |
@staticmethod
|
65 |
+
def filter_table(df: pd.DataFrame, filter_names: list[str], filter_names2: list[str],filter_name3: list[str]) -> pd.DataFrame:
|
66 |
df = df.loc[df.Type.isin(set(filter_names))]
|
67 |
+
df = df.loc[df.Type.isin(set(filter_names3))]
|
68 |
return df
|
69 |
|
70 |
@staticmethod
|
|
|
102 |
"""
|
103 |
with gr.Blocks(css=css) as demo:
|
104 |
search_box = gr.Textbox( label='Search Name', placeholder='You can search for titles with regular expressions. e.g. (?<!sur)face',max_lines=1, scale = 5)
|
105 |
+
with gr.Column(scale=1):
|
106 |
+
filter_names = gr.CheckboxGroup(choices=['Guidebook','Assessment Tool','Training and Education',], value=['Guidebook','Assessment Tool','Training and Education',], label='Type')
|
107 |
+
with gr.Column(scale=1):
|
108 |
+
filter_names2 = gr.CheckboxGroup(choices=['NIST AI RMF MAP','NIST AI RMF GOVERN','ISO 42001 A.8',], value=['NIST AI RMF MAP','NIST AI RMF GOVERN','ISO 42001 A.8',], label='Alignment with Key Guidance')
|
109 |
+
filter_names3 = gr.CheckboxGroup(choices=['Compliance and Regulatory Guidance', 'Generative AI', 'Suppliers and Procurement', 'Policy and Governance', 'Assessing AI Systems',], value=['Compliance and Regulatory Guidance', 'Generative AI', 'Suppliers and Procurement', 'Policy and Governance', 'Assessing AI Systems',], label='Modules')
|
110 |
search_button = gr.Button('Search', size = 'sm', scale =1)
|
111 |
|
112 |
with gr.Row():
|
113 |
table = gr.HTML(show_label=False)
|
114 |
|
115 |
+
demo.load(fn=data_list.render, inputs=[search_box, filter_names,filter_names2,filter_names3,],outputs=[table,])
|
116 |
+
search_box.submit(fn=data_list.render, inputs=[search_box, filter_names,filter_names2,filter_names3,], outputs=[table,])
|
117 |
+
search_button.click(fn=data_list.render, inputs=[search_box, filter_names,filter_names2,filter_names3,], outputs=[table,])
|
118 |
|
119 |
demo.queue()
|
120 |
demo.launch(share=False)
|