felipekitamura commited on
Commit
1d86238
·
verified ·
1 Parent(s): adcee14

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -2,12 +2,12 @@ import gradio as gr
2
  import pandas as pd
3
  import os
4
  import shutil
5
- from omnibin import generate_binary_classification_report
6
 
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
 
@@ -31,7 +31,7 @@ def process_csv(csv_file, n_bootstrap=1000, dpi=72, color="blue"):
31
  n_bootstrap=n_bootstrap,
32
  random_seed=42,
33
  dpi=dpi,
34
- color=color
35
  )
36
 
37
  # Get paths to individual plots
@@ -55,7 +55,7 @@ iface = gr.Interface(
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"),
@@ -70,7 +70,7 @@ iface = gr.Interface(
70
  description="Upload a CSV file containing 'y_true' and 'y_pred' columns to generate a binary classification report."
71
  "'y_true': reference standard (0s or 1s)."
72
  "'y_pred': model prediction (continuous value between 0 and 1)",
73
- examples=["scores.csv"],
74
  cache_examples=False
75
  )
76
 
 
2
  import pandas as pd
3
  import os
4
  import shutil
5
+ from omnibin import generate_binary_classification_report, ColorScheme
6
 
7
  # Define results directory
8
  RESULTS_DIR = "/tmp/results"
9
 
10
+ def process_csv(csv_file, n_bootstrap=1000, dpi=72, color_scheme=ColorScheme.DEFAULT):
11
  # Read the CSV file
12
  df = pd.read_csv(csv_file.name)
13
 
 
31
  n_bootstrap=n_bootstrap,
32
  random_seed=42,
33
  dpi=dpi,
34
+ color_scheme=color_scheme
35
  )
36
 
37
  # Get paths to individual plots
 
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 Scheme", choices=["DEFAULT", "MONOCHROME", "VIBRANT"], value="DEFAULT")
59
  ],
60
  outputs=[
61
  gr.File(label="Classification Report PDF"),
 
70
  description="Upload a CSV file containing 'y_true' and 'y_pred' columns to generate a binary classification report."
71
  "'y_true': reference standard (0s or 1s)."
72
  "'y_pred': model prediction (continuous value between 0 and 1)",
73
+ examples=["scores.csv", 1000, 72, "DEFAULT"],
74
  cache_examples=False
75
  )
76