Spaces:
Running
Running
Franny Dean
commited on
Commit
·
2586962
1
Parent(s):
34172e3
add EF, CO
Browse files- .ipynb_checkpoints/app-checkpoint.py +9 -8
- app.py +9 -8
.ipynb_checkpoints/app-checkpoint.py
CHANGED
|
@@ -805,12 +805,6 @@ def lvad_plots(Rm, Ra, Emax, Emin, Vd, Tc, start_v, gamma):
|
|
| 805 |
#compute new pv loops and ef with lvad added:
|
| 806 |
new_ef, pao_ed, pao_es, CO, MAP, Vlvs, Plvs = f_lvad(Rs, Rm, Ra, Rc, Ca, Cs, Cr, Ls, Emin, Vd, Tc, start_v, Emax, c, slope0, w0, x60, y00, y01, y02, y03, y04)
|
| 807 |
|
| 808 |
-
print("\nParameters: Tc, start_v, Emax:", Tc, start_v, Emax)
|
| 809 |
-
print("Suction speed:", suctionw)
|
| 810 |
-
print("EF before LVAD:", ef_nolvad)
|
| 811 |
-
print("CO before LVAD:", co_nolvad)
|
| 812 |
-
print("New EF after LVAD:", new_ef, "New CO:", CO, "New MAP:", MAP, "\n\n")
|
| 813 |
-
|
| 814 |
fig, ax = plt.subplots()
|
| 815 |
ax.plot(Vlv0, Plv0, color='blue', label='No LVAD') #blue
|
| 816 |
ax.plot(Vlvs, Plvs, color=(78/255, 192/255, 44/255), label=f"LVAD, ω(0)= {round(w0,2)}r/min") #green
|
|
@@ -821,7 +815,7 @@ def lvad_plots(Rm, Ra, Emax, Emin, Vd, Tc, start_v, gamma):
|
|
| 821 |
plt.xlim((0,250))
|
| 822 |
#plt.title('Simulated PI-SSL LV Pressure Volume Loop', fontsize=16)
|
| 823 |
|
| 824 |
-
return plt
|
| 825 |
|
| 826 |
title = "<h1 style='text-align: center; margin-bottom: 1rem'> Non-Invasive Medical Digital Twins using Physics-Informed Self-Supervised Learning </h1>"
|
| 827 |
|
|
@@ -897,11 +891,18 @@ with gr.Blocks() as demo:
|
|
| 897 |
|
| 898 |
with gr.Row():
|
| 899 |
lvad = gr.Plot()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 900 |
|
| 901 |
generate_button.click(fn=generate_example, outputs = [video,plot,Rm,Ra,Emax,Emin,Vd,Tc,start_v])
|
| 902 |
|
| 903 |
simulation_button.click(fn=pvloop_simulator_plot_only, inputs = [sl1,sl2,sl3,sl4,sl5,sl6,sl7], outputs = [simulation])
|
| 904 |
|
| 905 |
-
LVAD_button.click(fn=lvad_plots, inputs = [sl1,sl2,sl3,sl4,sl5,sl6,sl7,gamma], outputs = [lvad])
|
| 906 |
|
| 907 |
demo.launch()
|
|
|
|
| 805 |
#compute new pv loops and ef with lvad added:
|
| 806 |
new_ef, pao_ed, pao_es, CO, MAP, Vlvs, Plvs = f_lvad(Rs, Rm, Ra, Rc, Ca, Cs, Cr, Ls, Emin, Vd, Tc, start_v, Emax, c, slope0, w0, x60, y00, y01, y02, y03, y04)
|
| 807 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 808 |
fig, ax = plt.subplots()
|
| 809 |
ax.plot(Vlv0, Plv0, color='blue', label='No LVAD') #blue
|
| 810 |
ax.plot(Vlvs, Plvs, color=(78/255, 192/255, 44/255), label=f"LVAD, ω(0)= {round(w0,2)}r/min") #green
|
|
|
|
| 815 |
plt.xlim((0,250))
|
| 816 |
#plt.title('Simulated PI-SSL LV Pressure Volume Loop', fontsize=16)
|
| 817 |
|
| 818 |
+
return plt, ef_nolvad, new_ef, co_nolvad, CO
|
| 819 |
|
| 820 |
title = "<h1 style='text-align: center; margin-bottom: 1rem'> Non-Invasive Medical Digital Twins using Physics-Informed Self-Supervised Learning </h1>"
|
| 821 |
|
|
|
|
| 891 |
|
| 892 |
with gr.Row():
|
| 893 |
lvad = gr.Plot()
|
| 894 |
+
|
| 895 |
+
with gr.Row():
|
| 896 |
+
EF_o = gr.Number(label="Ejection fraction (EF) before LVAD:")
|
| 897 |
+
EF_n = gr.Number(label="Ejection fraction (EF) after LVAD:")
|
| 898 |
+
CO_o = gr.Number(label="Cardiac output before LVAD:")
|
| 899 |
+
CO_n = gr.Number(label="Cardiac output after LVAD:")
|
| 900 |
+
#MAP_n = gr.Number(label="Mean arterial pressure (MAP) after LVAD:")
|
| 901 |
|
| 902 |
generate_button.click(fn=generate_example, outputs = [video,plot,Rm,Ra,Emax,Emin,Vd,Tc,start_v])
|
| 903 |
|
| 904 |
simulation_button.click(fn=pvloop_simulator_plot_only, inputs = [sl1,sl2,sl3,sl4,sl5,sl6,sl7], outputs = [simulation])
|
| 905 |
|
| 906 |
+
LVAD_button.click(fn=lvad_plots, inputs = [sl1,sl2,sl3,sl4,sl5,sl6,sl7,gamma], outputs = [lvad, EF_o, EF_n, CO_o, CO_n])
|
| 907 |
|
| 908 |
demo.launch()
|
app.py
CHANGED
|
@@ -805,12 +805,6 @@ def lvad_plots(Rm, Ra, Emax, Emin, Vd, Tc, start_v, gamma):
|
|
| 805 |
#compute new pv loops and ef with lvad added:
|
| 806 |
new_ef, pao_ed, pao_es, CO, MAP, Vlvs, Plvs = f_lvad(Rs, Rm, Ra, Rc, Ca, Cs, Cr, Ls, Emin, Vd, Tc, start_v, Emax, c, slope0, w0, x60, y00, y01, y02, y03, y04)
|
| 807 |
|
| 808 |
-
print("\nParameters: Tc, start_v, Emax:", Tc, start_v, Emax)
|
| 809 |
-
print("Suction speed:", suctionw)
|
| 810 |
-
print("EF before LVAD:", ef_nolvad)
|
| 811 |
-
print("CO before LVAD:", co_nolvad)
|
| 812 |
-
print("New EF after LVAD:", new_ef, "New CO:", CO, "New MAP:", MAP, "\n\n")
|
| 813 |
-
|
| 814 |
fig, ax = plt.subplots()
|
| 815 |
ax.plot(Vlv0, Plv0, color='blue', label='No LVAD') #blue
|
| 816 |
ax.plot(Vlvs, Plvs, color=(78/255, 192/255, 44/255), label=f"LVAD, ω(0)= {round(w0,2)}r/min") #green
|
|
@@ -821,7 +815,7 @@ def lvad_plots(Rm, Ra, Emax, Emin, Vd, Tc, start_v, gamma):
|
|
| 821 |
plt.xlim((0,250))
|
| 822 |
#plt.title('Simulated PI-SSL LV Pressure Volume Loop', fontsize=16)
|
| 823 |
|
| 824 |
-
return plt
|
| 825 |
|
| 826 |
title = "<h1 style='text-align: center; margin-bottom: 1rem'> Non-Invasive Medical Digital Twins using Physics-Informed Self-Supervised Learning </h1>"
|
| 827 |
|
|
@@ -897,11 +891,18 @@ with gr.Blocks() as demo:
|
|
| 897 |
|
| 898 |
with gr.Row():
|
| 899 |
lvad = gr.Plot()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 900 |
|
| 901 |
generate_button.click(fn=generate_example, outputs = [video,plot,Rm,Ra,Emax,Emin,Vd,Tc,start_v])
|
| 902 |
|
| 903 |
simulation_button.click(fn=pvloop_simulator_plot_only, inputs = [sl1,sl2,sl3,sl4,sl5,sl6,sl7], outputs = [simulation])
|
| 904 |
|
| 905 |
-
LVAD_button.click(fn=lvad_plots, inputs = [sl1,sl2,sl3,sl4,sl5,sl6,sl7,gamma], outputs = [lvad])
|
| 906 |
|
| 907 |
demo.launch()
|
|
|
|
| 805 |
#compute new pv loops and ef with lvad added:
|
| 806 |
new_ef, pao_ed, pao_es, CO, MAP, Vlvs, Plvs = f_lvad(Rs, Rm, Ra, Rc, Ca, Cs, Cr, Ls, Emin, Vd, Tc, start_v, Emax, c, slope0, w0, x60, y00, y01, y02, y03, y04)
|
| 807 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 808 |
fig, ax = plt.subplots()
|
| 809 |
ax.plot(Vlv0, Plv0, color='blue', label='No LVAD') #blue
|
| 810 |
ax.plot(Vlvs, Plvs, color=(78/255, 192/255, 44/255), label=f"LVAD, ω(0)= {round(w0,2)}r/min") #green
|
|
|
|
| 815 |
plt.xlim((0,250))
|
| 816 |
#plt.title('Simulated PI-SSL LV Pressure Volume Loop', fontsize=16)
|
| 817 |
|
| 818 |
+
return plt, ef_nolvad, new_ef, co_nolvad, CO
|
| 819 |
|
| 820 |
title = "<h1 style='text-align: center; margin-bottom: 1rem'> Non-Invasive Medical Digital Twins using Physics-Informed Self-Supervised Learning </h1>"
|
| 821 |
|
|
|
|
| 891 |
|
| 892 |
with gr.Row():
|
| 893 |
lvad = gr.Plot()
|
| 894 |
+
|
| 895 |
+
with gr.Row():
|
| 896 |
+
EF_o = gr.Number(label="Ejection fraction (EF) before LVAD:")
|
| 897 |
+
EF_n = gr.Number(label="Ejection fraction (EF) after LVAD:")
|
| 898 |
+
CO_o = gr.Number(label="Cardiac output before LVAD:")
|
| 899 |
+
CO_n = gr.Number(label="Cardiac output after LVAD:")
|
| 900 |
+
#MAP_n = gr.Number(label="Mean arterial pressure (MAP) after LVAD:")
|
| 901 |
|
| 902 |
generate_button.click(fn=generate_example, outputs = [video,plot,Rm,Ra,Emax,Emin,Vd,Tc,start_v])
|
| 903 |
|
| 904 |
simulation_button.click(fn=pvloop_simulator_plot_only, inputs = [sl1,sl2,sl3,sl4,sl5,sl6,sl7], outputs = [simulation])
|
| 905 |
|
| 906 |
+
LVAD_button.click(fn=lvad_plots, inputs = [sl1,sl2,sl3,sl4,sl5,sl6,sl7,gamma], outputs = [lvad, EF_o, EF_n, CO_o, CO_n])
|
| 907 |
|
| 908 |
demo.launch()
|