Change to a more compact layout
Browse files
app.py
CHANGED
@@ -70,8 +70,8 @@ def get_proba_plots(
|
|
70 |
ax.set_xticks(ind + width)
|
71 |
ax.set_xticklabels(
|
72 |
[
|
73 |
-
f"{
|
74 |
-
f"{
|
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 |
-
|
92 |
-
|
93 |
-
"
|
94 |
-
"
|
95 |
-
"
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
|
|
|
|
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,
|