SnoopKilla commited on
Commit
3c54378
·
1 Parent(s): a28c22e

Update app.py to include initial values

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import os
 
2
  import gradio as gr
3
  import numpy as np
4
  import matplotlib
@@ -79,7 +80,7 @@ if __name__ == "__main__":
79
  # Inputs
80
  dropdown = gr.Dropdown(choices=countries, value="Germany",
81
  label="Select the Country")
82
- slider = gr.Slider(minimum=1, maximum=5, value=3, step=1,
83
  label="Select the Number of Breakpoints")
84
  n_iterations = gr.Number(value=10000, precision=0,
85
  label="Select the Number of iterations")
@@ -88,9 +89,13 @@ if __name__ == "__main__":
88
  info="Such iterations will be discarded.")
89
 
90
  # Outputs
91
- plot = gr.Plot(label="Results")
92
- lam = gr.Text(label="Estimated Lambda")
93
- t = gr.Text(label="Estimated Breakpoints")
 
 
 
 
94
  p = gr.Text(label="Estimated Recovery Probability")
95
  interface = gr.Interface(sample,
96
  inputs=[dropdown, slider, n_iterations, burnin],
 
1
  import os
2
+ import pickle
3
  import gradio as gr
4
  import numpy as np
5
  import matplotlib
 
80
  # Inputs
81
  dropdown = gr.Dropdown(choices=countries, value="Germany",
82
  label="Select the Country")
83
+ slider = gr.Slider(minimum=1, maximum=5, value=4, step=1,
84
  label="Select the Number of Breakpoints")
85
  n_iterations = gr.Number(value=10000, precision=0,
86
  label="Select the Number of iterations")
 
89
  info="Such iterations will be discarded.")
90
 
91
  # Outputs
92
+ initial_plot = pickle.load(open("data/germany_estimate.pkl", "rb"))
93
+ plot = gr.Plot(value=initial_plot, label="Results")
94
+ initial_lam = "Component 1: 0.3114\nComponent 2: 0.1499\nComponent 3: 0.0822\nComponent 4: 0.0419"
95
+ lam = gr.Text(value=initial_lam, label="Estimated Lambda")
96
+ initial_t = "Breakpoint 1: 19\nBreakpoint 2: 29\nBreakpoint3: 38"
97
+ t = gr.Text(value=initial_t, label="Estimated Breakpoints")
98
+ initial_p = "0.0653"
99
  p = gr.Text(label="Estimated Recovery Probability")
100
  interface = gr.Interface(sample,
101
  inputs=[dropdown, slider, n_iterations, burnin],