cmpatino commited on
Commit
fc66475
·
1 Parent(s): 307e9da

Change to a more compact layout

Browse files
Files changed (1) hide show
  1. app.py +44 -42
app.py CHANGED
@@ -70,8 +70,8 @@ def get_proba_plots(
70
  ax.set_xticks(ind + width)
71
  ax.set_xticklabels(
72
  [
73
- f"{model_2}\nweight {model_1_weight}",
74
- f"{model_1}\nweight {model_2_weight}",
75
  f"{model_3}\nweight {model_3_weight}",
76
  "VotingClassifier\n(average probabilities)",
77
  ],
@@ -88,46 +88,48 @@ def get_proba_plots(
88
 
89
  with gr.Blocks() as demo:
90
  with gr.Row():
91
- model_1 = gr.Dropdown(
92
- [
93
- "Logistic Regression",
94
- "Random Forest",
95
- "Gaussian Naive Bayes",
96
- ],
97
- label="Model 1",
98
- value="Logistic Regression",
99
- )
100
- model_2 = gr.Dropdown(
101
- [
102
- "Logistic Regression",
103
- "Random Forest",
104
- "Gaussian Naive Bayes",
105
- ],
106
- label="Model 2",
107
- value="Random Forest",
108
- )
109
- model_3 = gr.Dropdown(
110
- [
111
- "Logistic Regression",
112
- "Random Forest",
113
- "Gaussian Naive Bayes",
114
- ],
115
- label="Model 3",
116
- value="Gaussian Naive Bayes",
117
- )
118
-
119
- with gr.Row():
120
- model_1_weight = gr.Slider(
121
- minimum=1, maximum=10, value=1, label="Model 1 Weight", step=1
122
- )
123
- model_2_weight = gr.Slider(
124
- minimum=1, maximum=10, value=1, label="Model 2 Weight", step=1
125
- )
126
- model_3_weight = gr.Slider(
127
- minimum=1, maximum=10, value=5, label="Model 3 Weight", step=1
128
- )
129
-
130
- proba_plots = gr.Plot()
 
 
131
 
132
  model_1.change(
133
  get_proba_plots,
 
70
  ax.set_xticks(ind + width)
71
  ax.set_xticklabels(
72
  [
73
+ f"{model_1}\nweight {model_1_weight}",
74
+ f"{model_2}\nweight {model_2_weight}",
75
  f"{model_3}\nweight {model_3_weight}",
76
  "VotingClassifier\n(average probabilities)",
77
  ],
 
88
 
89
  with gr.Blocks() as demo:
90
  with gr.Row():
91
+ with gr.Column(scale=3):
92
+ gr.Markdown(
93
+ "Choose the type of model and the weight of each model in the final vote." # noqa: E501
94
+ + " For example if you set weights to 1, 1, 5 for the three models,"
95
+ + " the third model will have 5 times more weight than the other two models." # noqa: E501
96
+ )
97
+ with gr.Row():
98
+ model_1 = gr.Dropdown(
99
+ [
100
+ "Logistic Regression",
101
+ "Random Forest",
102
+ "Gaussian Naive Bayes",
103
+ ],
104
+ label="Model 1",
105
+ value="Logistic Regression",
106
+ )
107
+ model_1_weight = gr.Number(value=1, label="Model 1 Weight", precision=0)
108
+ with gr.Row():
109
+ model_2 = gr.Dropdown(
110
+ [
111
+ "Logistic Regression",
112
+ "Random Forest",
113
+ "Gaussian Naive Bayes",
114
+ ],
115
+ label="Model 2",
116
+ value="Random Forest",
117
+ )
118
+ model_2_weight = gr.Number(value=1, label="Model 2 Weight", precision=0)
119
+ with gr.Row():
120
+ model_3 = gr.Dropdown(
121
+ [
122
+ "Logistic Regression",
123
+ "Random Forest",
124
+ "Gaussian Naive Bayes",
125
+ ],
126
+ label="Model 3",
127
+ value="Gaussian Naive Bayes",
128
+ )
129
+
130
+ model_3_weight = gr.Number(value=5, label="Model 3 Weight", precision=0)
131
+ with gr.Column(scale=4):
132
+ proba_plots = gr.Plot()
133
 
134
  model_1.change(
135
  get_proba_plots,