cmpatino commited on
Commit
7e26e61
·
1 Parent(s): cdcefb0

Change inputs from number to sliders

Browse files
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -48,7 +48,7 @@ def get_plots(min_alpha, max_alpha):
48
  plotted_alphas_text = (
49
  f"**Plotted alphas between 10^({min_alpha}) and 10^({max_alpha})**"
50
  )
51
- return fig
52
 
53
 
54
  with gr.Blocks() as demo:
@@ -68,38 +68,44 @@ with gr.Blocks() as demo:
68
  """
69
  )
70
  with gr.Row():
71
- with gr.Column(scale=3):
72
  with gr.Row():
73
- min_alpha = gr.Number(
74
  step=1,
75
  value=-6,
 
 
76
  label="Minimum Alpha Exponent",
77
  )
78
- max_alpha = gr.Number(
79
  step=1,
 
 
80
  value=6,
81
  label="Maximum Alpha Exponent",
82
  )
 
 
83
 
84
  plots = gr.Plot()
85
 
86
  min_alpha.change(
87
  get_plots,
88
  [min_alpha, max_alpha],
89
- plots,
90
  queue=False,
91
  )
92
  max_alpha.change(
93
  get_plots,
94
  [min_alpha, max_alpha],
95
- plots,
96
  queue=False,
97
  )
98
 
99
  demo.load(
100
  get_plots,
101
  [min_alpha, max_alpha],
102
- plots,
103
  queue=False,
104
  )
105
 
 
48
  plotted_alphas_text = (
49
  f"**Plotted alphas between 10^({min_alpha}) and 10^({max_alpha})**"
50
  )
51
+ return fig, plotted_alphas_text
52
 
53
 
54
  with gr.Blocks() as demo:
 
68
  """
69
  )
70
  with gr.Row():
71
+ with gr.Column(scale=5):
72
  with gr.Row():
73
+ min_alpha = gr.Slider(
74
  step=1,
75
  value=-6,
76
+ minimum=-10,
77
+ maximum=-1,
78
  label="Minimum Alpha Exponent",
79
  )
80
+ max_alpha = gr.Slider(
81
  step=1,
82
+ minimum=0,
83
+ maximum=10,
84
  value=6,
85
  label="Maximum Alpha Exponent",
86
  )
87
+ with gr.Column(scale=1):
88
+ plotted_alphas_text = gr.Markdown()
89
 
90
  plots = gr.Plot()
91
 
92
  min_alpha.change(
93
  get_plots,
94
  [min_alpha, max_alpha],
95
+ [plots, plotted_alphas_text],
96
  queue=False,
97
  )
98
  max_alpha.change(
99
  get_plots,
100
  [min_alpha, max_alpha],
101
+ [plots, plotted_alphas_text],
102
  queue=False,
103
  )
104
 
105
  demo.load(
106
  get_plots,
107
  [min_alpha, max_alpha],
108
+ [plots, plotted_alphas_text],
109
  queue=False,
110
  )
111