Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ from omnibin import generate_binary_classification_report
|
|
7 |
# Define results directory
|
8 |
RESULTS_DIR = "/tmp/results"
|
9 |
|
10 |
-
def process_csv(csv_file):
|
11 |
# Read the CSV file
|
12 |
df = pd.read_csv(csv_file.name)
|
13 |
|
@@ -28,9 +28,10 @@ def process_csv(csv_file):
|
|
28 |
y_true=df['y_true'].values,
|
29 |
y_scores=df['y_pred'].values,
|
30 |
output_path=os.path.join(RESULTS_DIR, "classification_report.pdf"),
|
31 |
-
n_bootstrap=
|
32 |
random_seed=42,
|
33 |
-
dpi=
|
|
|
34 |
)
|
35 |
|
36 |
# Get paths to individual plots
|
@@ -50,7 +51,12 @@ def process_csv(csv_file):
|
|
50 |
# Create the Gradio interface
|
51 |
iface = gr.Interface(
|
52 |
fn=process_csv,
|
53 |
-
inputs=
|
|
|
|
|
|
|
|
|
|
|
54 |
outputs=[
|
55 |
gr.File(label="Classification Report PDF"),
|
56 |
gr.Image(label="ROC and PR Curves"),
|
|
|
7 |
# Define results directory
|
8 |
RESULTS_DIR = "/tmp/results"
|
9 |
|
10 |
+
def process_csv(csv_file, n_bootstrap=1000, dpi=72, color="blue"):
|
11 |
# Read the CSV file
|
12 |
df = pd.read_csv(csv_file.name)
|
13 |
|
|
|
28 |
y_true=df['y_true'].values,
|
29 |
y_scores=df['y_pred'].values,
|
30 |
output_path=os.path.join(RESULTS_DIR, "classification_report.pdf"),
|
31 |
+
n_bootstrap=n_bootstrap,
|
32 |
random_seed=42,
|
33 |
+
dpi=dpi,
|
34 |
+
color=color
|
35 |
)
|
36 |
|
37 |
# Get paths to individual plots
|
|
|
51 |
# Create the Gradio interface
|
52 |
iface = gr.Interface(
|
53 |
fn=process_csv,
|
54 |
+
inputs=[
|
55 |
+
gr.File(label="Upload CSV file with 'y_true' and 'y_pred' columns"),
|
56 |
+
gr.Number(label="Number of Bootstrap Iterations", value=1000, minimum=100, maximum=10000),
|
57 |
+
gr.Number(label="DPI", value=72, minimum=50, maximum=300),
|
58 |
+
gr.Dropdown(label="Color", choices=["blue", "red", "green", "purple", "orange"], value="blue")
|
59 |
+
],
|
60 |
outputs=[
|
61 |
gr.File(label="Classification Report PDF"),
|
62 |
gr.Image(label="ROC and PR Curves"),
|