Joe Chi
commited on
Commit
•
ac1423c
1
Parent(s):
f28f295
Fix figure not show bug
Browse files
app.py
CHANGED
@@ -59,8 +59,6 @@ def plot_figs(fig_num, elev, azim):
|
|
59 |
ax.yaxis.set_ticklabels([])
|
60 |
ax.zaxis.set_ticklabels([])
|
61 |
|
62 |
-
plt.savefig(f"{fig_num}.png")
|
63 |
-
|
64 |
return fig
|
65 |
|
66 |
def make_plot(plot_type):
|
@@ -72,7 +70,7 @@ def make_plot(plot_type):
|
|
72 |
elev = 30
|
73 |
azim = 20
|
74 |
fig_num = 2
|
75 |
-
plot_figs(fig_num, elev, azim)
|
76 |
|
77 |
title = "Principal components analysis (PCA)"
|
78 |
with gr.Blocks(title=title) as demo:
|
@@ -84,7 +82,8 @@ with gr.Blocks(title=title) as demo:
|
|
84 |
button = gr.Radio(label="Plot type",
|
85 |
choices=['Very flat direction', 'Not flat direction'], value='Very flat direction')
|
86 |
plot = gr.Plot(label="Plot")
|
87 |
-
button.change(make_plot, inputs=button, outputs=
|
88 |
-
demo.load(make_plot, inputs=
|
89 |
|
90 |
-
|
|
|
|
59 |
ax.yaxis.set_ticklabels([])
|
60 |
ax.zaxis.set_ticklabels([])
|
61 |
|
|
|
|
|
62 |
return fig
|
63 |
|
64 |
def make_plot(plot_type):
|
|
|
70 |
elev = 30
|
71 |
azim = 20
|
72 |
fig_num = 2
|
73 |
+
return plot_figs(fig_num, elev, azim)
|
74 |
|
75 |
title = "Principal components analysis (PCA)"
|
76 |
with gr.Blocks(title=title) as demo:
|
|
|
82 |
button = gr.Radio(label="Plot type",
|
83 |
choices=['Very flat direction', 'Not flat direction'], value='Very flat direction')
|
84 |
plot = gr.Plot(label="Plot")
|
85 |
+
button.change(make_plot, inputs=button, outputs=plot)
|
86 |
+
demo.load(make_plot, inputs=button, outputs=plot)
|
87 |
|
88 |
+
if __name__ == "__main__":
|
89 |
+
demo.launch()
|