ccm commited on
Commit
728bce4
·
1 Parent(s): cb4bbf8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -0
app.py CHANGED
@@ -232,6 +232,46 @@ with gradio.Blocks() as analysis_demo:
232
  btn1.click(fn=geometry, inputs=[num], outputs=[geo])
233
  btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
234
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  with gradio.Blocks() as synthesis_demo:
236
  with gradio.Row():
237
  with gradio.Column():
 
232
  btn1.click(fn=geometry, inputs=[num], outputs=[geo])
233
  btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
234
 
235
+
236
+ def change_textbox(choice):
237
+ if choice == "cylinder":
238
+ return [gr.Slider.update(visible=True), gr.Slider.update(visible=True), gr.Slider.update(visible=False)]
239
+ elif choice == "sphere":
240
+ return [gr.Slider.update(visible=False), gr.Slider.update(visible=True), gr.Slider.update(visible=False)]
241
+ elif choice == "cube":
242
+ return [gr.Slider.update(visible=False), gr.Slider.update(visible=False), gr.Slider.update(visible=True)]
243
+
244
+
245
+ with gradio.Blocks() as analysis_demo_from_params:
246
+ with gradio.Row():
247
+ with gradio.Column():
248
+ radio = gr.Radio(
249
+ ["cylinder", "sphere", "cube"], label="What kind of essay would you like to write?"
250
+ )
251
+ text1 = gr.Slider(label="Height")
252
+ text2 = gr.Slider(label="Radius")
253
+ text3 = gr.Slider(label="Side Length")
254
+
255
+ radio.change(fn=change_textbox, inputs=radio, outputs=[text1, text2, text3])
256
+
257
+ with gradio.Column():
258
+ geo = gradio.Plot(label="Geometry")
259
+
260
+ with gradio.Row():
261
+ btn2 = gradio.Button("Estimate Spectrum")
262
+
263
+ with gradio.Row():
264
+ with gradio.Column():
265
+ pred = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="Predicted")
266
+
267
+ with gradio.Column():
268
+ true = gradio.Timeseries(x="Frequency", y=['Surge', 'Heave', 'Pitch'], label="True")
269
+
270
+ btn1.click(fn=geometry, inputs=[num], outputs=[geo])
271
+ btn2.click(fn=simple_analysis, inputs=[num], outputs=[pred, true])
272
+
273
+
274
+
275
  with gradio.Blocks() as synthesis_demo:
276
  with gradio.Row():
277
  with gradio.Column():