Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -100,17 +100,21 @@ def simulation(input_noise, output_noise, min, max, std, mean, min_pul, max_pul,
|
|
100 |
fmu.freeInstance()
|
101 |
shutil.rmtree(unzipdir, ignore_errors=True)
|
102 |
result = np.array(rows, dtype=np.dtype([('time', np.float64), ('BIS', np.float64), ('Infusion', np.float64)]))
|
|
|
103 |
df = pd.DataFrame(result)
|
|
|
104 |
trace1 = go.Scatter(x=df.index, y=df['BIS'], mode='lines', name='BIS')
|
105 |
fig1 = go.Figure(data=trace1)
|
106 |
fig1.update_layout(height=400, width=1200, title_text="BIS evolution")
|
|
|
107 |
|
108 |
# Add a line trace for column_2 in the second subplot
|
109 |
trace2 = go.Scatter(x=df.index, y=df['Infusion'], mode='lines', name='Infusion')
|
110 |
fig2 = go.Figure(data=trace2)
|
111 |
fig2.update_layout(height=400, width=1200, title_text="Infusion evolution")
|
|
|
112 |
|
113 |
-
return fig1, fig2
|
114 |
import gradio as gr
|
115 |
with gr.Blocks() as demo:
|
116 |
with gr.Row():
|
|
|
100 |
fmu.freeInstance()
|
101 |
shutil.rmtree(unzipdir, ignore_errors=True)
|
102 |
result = np.array(rows, dtype=np.dtype([('time', np.float64), ('BIS', np.float64), ('Infusion', np.float64)]))
|
103 |
+
result_baseline = np.load("result.npy")
|
104 |
df = pd.DataFrame(result)
|
105 |
+
df_original = pd.DataFrame(result_baseline)
|
106 |
trace1 = go.Scatter(x=df.index, y=df['BIS'], mode='lines', name='BIS')
|
107 |
fig1 = go.Figure(data=trace1)
|
108 |
fig1.update_layout(height=400, width=1200, title_text="BIS evolution")
|
109 |
+
fig1.add_trace(go.Scatter(x=df_original.index, y=df_original['BIS'], mode='lines', name='BIS original', line=dict(color="red"), opacity=0.5),)
|
110 |
|
111 |
# Add a line trace for column_2 in the second subplot
|
112 |
trace2 = go.Scatter(x=df.index, y=df['Infusion'], mode='lines', name='Infusion')
|
113 |
fig2 = go.Figure(data=trace2)
|
114 |
fig2.update_layout(height=400, width=1200, title_text="Infusion evolution")
|
115 |
+
fig2.add_trace(go.Scatter(x=df_original.index, y=df_original['Infusion'], mode='lines', name='Infusion original', line=dict(color="red"), opacity=0.5))
|
116 |
|
117 |
+
return fig1, fig2
|
118 |
import gradio as gr
|
119 |
with gr.Blocks() as demo:
|
120 |
with gr.Row():
|