Commit
·
1954c4b
1
Parent(s):
6ba03de
refine
Browse files
app.py
CHANGED
@@ -3,10 +3,10 @@ import gradio as gr
|
|
3 |
import pandas as pd
|
4 |
|
5 |
# Load the uc_result.csv file
|
6 |
-
uc_result_df = pd.read_csv('
|
7 |
|
8 |
# Convert percentage columns to float for sorting
|
9 |
-
percentage_columns = [col for col in uc_result_df.columns if
|
10 |
for col in percentage_columns:
|
11 |
uc_result_df[col] = uc_result_df[col].str.rstrip('%').astype('float') / 100
|
12 |
|
@@ -14,21 +14,21 @@ for col in percentage_columns:
|
|
14 |
def filter_and_sort(method=None, sort_by=None, ascending=True):
|
15 |
filtered_df = uc_result_df
|
16 |
if method:
|
17 |
-
filtered_df = filtered_df[filtered_df['Method'].str.contains(method)]
|
18 |
if sort_by:
|
19 |
filtered_df = filtered_df.sort_values(by=sort_by, ascending=ascending)
|
20 |
return filtered_df
|
21 |
|
22 |
# Create Gradio interface components
|
23 |
-
method_input = gr.
|
24 |
-
sort_by_dropdown = gr.
|
25 |
-
ascending_checkbox = gr.
|
26 |
|
27 |
# Create a Gradio interface to display the data
|
28 |
iface = gr.Interface(
|
29 |
fn=filter_and_sort,
|
30 |
inputs=[method_input, sort_by_dropdown, ascending_checkbox],
|
31 |
-
outputs=gr.
|
32 |
title="Enhanced UC Results Display",
|
33 |
description="This interface allows filtering and sorting of the results from uc_result.csv"
|
34 |
)
|
|
|
3 |
import pandas as pd
|
4 |
|
5 |
# Load the uc_result.csv file
|
6 |
+
uc_result_df = pd.read_csv('uc_result.csv')
|
7 |
|
8 |
# Convert percentage columns to float for sorting
|
9 |
+
percentage_columns = [col for col in uc_result_df.columns if '%' in str(uc_result_df[col].iloc[0])]
|
10 |
for col in percentage_columns:
|
11 |
uc_result_df[col] = uc_result_df[col].str.rstrip('%').astype('float') / 100
|
12 |
|
|
|
14 |
def filter_and_sort(method=None, sort_by=None, ascending=True):
|
15 |
filtered_df = uc_result_df
|
16 |
if method:
|
17 |
+
filtered_df = filtered_df[filtered_df['Method'].str.contains(method, case=False, na=False)]
|
18 |
if sort_by:
|
19 |
filtered_df = filtered_df.sort_values(by=sort_by, ascending=ascending)
|
20 |
return filtered_df
|
21 |
|
22 |
# Create Gradio interface components
|
23 |
+
method_input = gr.Textbox(label="Filter by Method", placeholder="Enter method name...")
|
24 |
+
sort_by_dropdown = gr.Dropdown(label="Sort by", choices=uc_result_df.columns.tolist(), default=None)
|
25 |
+
ascending_checkbox = gr.Checkbox(label="Ascending Order", value=True)
|
26 |
|
27 |
# Create a Gradio interface to display the data
|
28 |
iface = gr.Interface(
|
29 |
fn=filter_and_sort,
|
30 |
inputs=[method_input, sort_by_dropdown, ascending_checkbox],
|
31 |
+
outputs=gr.DataFrame(),
|
32 |
title="Enhanced UC Results Display",
|
33 |
description="This interface allows filtering and sorting of the results from uc_result.csv"
|
34 |
)
|