Change app's layout
Browse files
app.py
CHANGED
|
@@ -41,52 +41,55 @@ def get_plots(min_alpha, max_alpha):
|
|
| 41 |
ax[1].set_title("Coefficient error as a function of the regularization")
|
| 42 |
fig.tight_layout()
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
|
| 47 |
with gr.Blocks() as demo:
|
| 48 |
with gr.Row():
|
| 49 |
-
with gr.Column(scale=
|
| 50 |
gr.Markdown(
|
| 51 |
"Choose the range of alpha values to plot."
|
| 52 |
+ " The models you input for alpha are for the exponents of 10,"
|
| 53 |
-
+ " so a value of -6 means 10
|
| 54 |
-
)
|
| 55 |
-
min_alpha = gr.Slider(
|
| 56 |
-
minimum=-10,
|
| 57 |
-
maximum=10,
|
| 58 |
-
step=0.5,
|
| 59 |
-
value=-6,
|
| 60 |
-
label="Minimum Alpha Exponent",
|
| 61 |
-
)
|
| 62 |
-
max_alpha = gr.Slider(
|
| 63 |
-
minimum=-10,
|
| 64 |
-
maximum=10,
|
| 65 |
-
step=0.5,
|
| 66 |
-
value=6,
|
| 67 |
-
label="Maximum Alpha Exponent",
|
| 68 |
)
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
min_alpha.change(
|
| 74 |
get_plots,
|
| 75 |
[min_alpha, max_alpha],
|
| 76 |
-
plots,
|
| 77 |
queue=False,
|
| 78 |
)
|
| 79 |
max_alpha.change(
|
| 80 |
get_plots,
|
| 81 |
[min_alpha, max_alpha],
|
| 82 |
-
plots,
|
| 83 |
queue=False,
|
| 84 |
)
|
| 85 |
|
| 86 |
demo.load(
|
| 87 |
get_plots,
|
| 88 |
[min_alpha, max_alpha],
|
| 89 |
-
plots,
|
| 90 |
queue=False,
|
| 91 |
)
|
| 92 |
|
|
|
|
| 41 |
ax[1].set_title("Coefficient error as a function of the regularization")
|
| 42 |
fig.tight_layout()
|
| 43 |
|
| 44 |
+
plotted_alphas_text = (
|
| 45 |
+
f"**Plotted alphas between 10^({min_alpha}) and 10^({max_alpha})**"
|
| 46 |
+
)
|
| 47 |
+
return fig, plotted_alphas_text
|
| 48 |
|
| 49 |
|
| 50 |
with gr.Blocks() as demo:
|
| 51 |
with gr.Row():
|
| 52 |
+
with gr.Column(scale=2):
|
| 53 |
gr.Markdown(
|
| 54 |
"Choose the range of alpha values to plot."
|
| 55 |
+ " The models you input for alpha are for the exponents of 10,"
|
| 56 |
+
+ " so a value of -6 means 10^6."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
)
|
| 58 |
|
| 59 |
+
plotted_alphas = gr.Markdown()
|
| 60 |
+
|
| 61 |
+
with gr.Column(scale=3):
|
| 62 |
+
with gr.Row():
|
| 63 |
+
min_alpha = gr.Number(
|
| 64 |
+
step=1,
|
| 65 |
+
value=-6,
|
| 66 |
+
label="Minimum Alpha Exponent",
|
| 67 |
+
)
|
| 68 |
+
max_alpha = gr.Number(
|
| 69 |
+
step=1,
|
| 70 |
+
value=6,
|
| 71 |
+
label="Maximum Alpha Exponent",
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
plots = gr.Plot()
|
| 75 |
|
| 76 |
min_alpha.change(
|
| 77 |
get_plots,
|
| 78 |
[min_alpha, max_alpha],
|
| 79 |
+
[plots, plotted_alphas],
|
| 80 |
queue=False,
|
| 81 |
)
|
| 82 |
max_alpha.change(
|
| 83 |
get_plots,
|
| 84 |
[min_alpha, max_alpha],
|
| 85 |
+
[plots, plotted_alphas],
|
| 86 |
queue=False,
|
| 87 |
)
|
| 88 |
|
| 89 |
demo.load(
|
| 90 |
get_plots,
|
| 91 |
[min_alpha, max_alpha],
|
| 92 |
+
[plots, plotted_alphas],
|
| 93 |
queue=False,
|
| 94 |
)
|
| 95 |
|