RamAnanth1 commited on
Commit
6f418fd
·
1 Parent(s): 059f046

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -64,10 +64,19 @@ simulation = Executor(exec_context=exec_context, configs=experiment.configs)
64
 
65
 
66
 
67
- def greet(name):
68
  raw_result, tensor_fields, sessions = simulation.execute()
69
  result = pd.DataFrame(raw_result)
70
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
71
 
72
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
73
  iface.launch()
 
64
 
65
 
66
 
67
+ def plot_seir(name):
68
  raw_result, tensor_fields, sessions = simulation.execute()
69
  result = pd.DataFrame(raw_result)
70
+ pd.options.plotting.backend = "plotly"
71
+ fig = result.plot(
72
+ kind = "line",
73
+ x = "timestep",
74
+ y= ["S","E","I", "R"])
75
+ fig.update_layout(title = name,
76
+ xaxis_title="Time (Days)",
77
+ yaxis_title="People")
78
+ return fig
79
 
80
+ graph = gr.Plot()
81
+ iface = gr.Interface(fn=plot_seir, inputs="text", outputs=graph)
82
  iface.launch()