Update app.py
Browse files
app.py
CHANGED
|
@@ -85,18 +85,20 @@ def calculate_column_widths(df):
|
|
| 85 |
return column_widths
|
| 86 |
|
| 87 |
|
| 88 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
-
# def filter_df(model_name):
|
| 91 |
-
# df = make_results_tab(model_info, results)
|
| 92 |
-
# default_val = 'Input the Model Name (fuzzy)'
|
| 93 |
-
# if model_name != default_val:
|
| 94 |
-
# method_names = [x.split('</a>')[0].split('>')[-1].lower() for x in df['Model Name']]
|
| 95 |
-
# flag = [model_name.lower() in name for name in method_names]
|
| 96 |
-
# df['TEMP'] = flag
|
| 97 |
-
# df = df[df['TEMP'] == True]
|
| 98 |
-
# df.pop('TEMP')
|
| 99 |
-
# return df
|
| 100 |
|
| 101 |
with gr.Row():
|
| 102 |
model_name = gr.Textbox(
|
|
@@ -106,7 +108,6 @@ def show_results_tab(df, model_info, results):
|
|
| 106 |
)
|
| 107 |
|
| 108 |
|
| 109 |
-
|
| 110 |
table = gr.DataFrame(
|
| 111 |
value=df,
|
| 112 |
interactive=False,
|
|
@@ -114,11 +115,11 @@ def show_results_tab(df, model_info, results):
|
|
| 114 |
column_widths=calculate_column_widths(df),
|
| 115 |
)
|
| 116 |
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
|
| 123 |
|
| 124 |
|
|
@@ -131,7 +132,7 @@ def create_interface():
|
|
| 131 |
with gr.Tabs(elem_classes='tab-buttons') as tabs:
|
| 132 |
with gr.TabItem('Results', elem_id='main', id=0):
|
| 133 |
df = make_results_tab(model_info, results)
|
| 134 |
-
show_results_tab(df
|
| 135 |
|
| 136 |
with gr.TabItem('Predictions', elem_id='notmain', id=1):
|
| 137 |
# dataset_tab(results, structs[i], dataset)
|
|
|
|
| 85 |
return column_widths
|
| 86 |
|
| 87 |
|
| 88 |
+
def filter_df(df, model_name):
|
| 89 |
+
default_val = 'Input the Model Name (fuzzy)'
|
| 90 |
+
if model_name != default_val:
|
| 91 |
+
method_names = [x.split('</a>')[0].split('>')[-1].lower() for x in df['Model Name']]
|
| 92 |
+
flag = [model_name.lower() in name for name in method_names]
|
| 93 |
+
df['TEMP'] = flag
|
| 94 |
+
df = df[df['TEMP'] == True]
|
| 95 |
+
df.pop('TEMP')
|
| 96 |
+
return df
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
def show_results_tab(df):
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
with gr.Row():
|
| 104 |
model_name = gr.Textbox(
|
|
|
|
| 108 |
)
|
| 109 |
|
| 110 |
|
|
|
|
| 111 |
table = gr.DataFrame(
|
| 112 |
value=df,
|
| 113 |
interactive=False,
|
|
|
|
| 115 |
column_widths=calculate_column_widths(df),
|
| 116 |
)
|
| 117 |
|
| 118 |
+
search_box.submit(
|
| 119 |
+
fn=filter_df,
|
| 120 |
+
inputs=[df, search_box]
|
| 121 |
+
outputs=table
|
| 122 |
+
)
|
| 123 |
|
| 124 |
|
| 125 |
|
|
|
|
| 132 |
with gr.Tabs(elem_classes='tab-buttons') as tabs:
|
| 133 |
with gr.TabItem('Results', elem_id='main', id=0):
|
| 134 |
df = make_results_tab(model_info, results)
|
| 135 |
+
show_results_tab(df)
|
| 136 |
|
| 137 |
with gr.TabItem('Predictions', elem_id='notmain', id=1):
|
| 138 |
# dataset_tab(results, structs[i], dataset)
|