Update app.py
Browse files
app.py
CHANGED
@@ -208,6 +208,8 @@ def change_textbox(choice):
|
|
208 |
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False)]
|
209 |
|
210 |
|
|
|
|
|
211 |
def geometry_change(choice):
|
212 |
if choice == "Construct Shape from Parameters":
|
213 |
return [gradio.Radio.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Number.update(visible=False), gradio.Timeseries.update(visible=False)]
|
@@ -242,7 +244,7 @@ with gradio.Blocks() as demo:
|
|
242 |
radio.change(fn=change_textbox, inputs=radio, outputs=[height, width, diameter, length])
|
243 |
num = gradio.Number(42, label="Type the index of the shape you would like to use or randomly select it.", visible=False)
|
244 |
|
245 |
-
btn1 = gradio.Button("
|
246 |
with gradio.Column():
|
247 |
geo = gradio.Plot(label="Geometry")
|
248 |
|
@@ -258,6 +260,7 @@ with gradio.Blocks() as demo:
|
|
258 |
|
259 |
whence_commeth_geometry.change(fn=geometry_change, inputs=[whence_commeth_geometry], outputs=[radio, height, width, diameter, length, num, true])
|
260 |
num.change(fn=geometry, inputs=[num], outputs=[geo])
|
|
|
261 |
btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
|
262 |
|
263 |
with gradio.Tab("Synthesis"):
|
|
|
208 |
return [gradio.Slider.update(visible=True), gradio.Slider.update(visible=False), gradio.Slider.update(visible=True), gradio.Slider.update(visible=False)]
|
209 |
|
210 |
|
211 |
+
import random
|
212 |
+
|
213 |
def geometry_change(choice):
|
214 |
if choice == "Construct Shape from Parameters":
|
215 |
return [gradio.Radio.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Slider.update(visible=True), gradio.Number.update(visible=False), gradio.Timeseries.update(visible=False)]
|
|
|
244 |
radio.change(fn=change_textbox, inputs=radio, outputs=[height, width, diameter, length])
|
245 |
num = gradio.Number(42, label="Type the index of the shape you would like to use or randomly select it.", visible=False)
|
246 |
|
247 |
+
btn1 = gradio.Button("Randomize")
|
248 |
with gradio.Column():
|
249 |
geo = gradio.Plot(label="Geometry")
|
250 |
|
|
|
260 |
|
261 |
whence_commeth_geometry.change(fn=geometry_change, inputs=[whence_commeth_geometry], outputs=[radio, height, width, diameter, length, num, true])
|
262 |
num.change(fn=geometry, inputs=[num], outputs=[geo])
|
263 |
+
btn1.click(fn=lambda: x = random.randint(1, 4999); num.update(value=x); geometry(x), outputs=[geo])
|
264 |
btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
|
265 |
|
266 |
with gradio.Tab("Synthesis"):
|