Spaces:
Running
Running
Franny Dean
commited on
Commit
•
7a57c2f
1
Parent(s):
f4f238a
attempt saving gif
Browse files- .ipynb_checkpoints/app-checkpoint.py +5 -3
- app.py +5 -3
.ipynb_checkpoints/app-checkpoint.py
CHANGED
@@ -482,11 +482,12 @@ def pvloop_simulator(Rm, Ra, Emax, Emin, Vd, Tc, start_v):
|
|
482 |
ax.plot(x, y, lw=1, c='b')
|
483 |
|
484 |
anim = animation.FuncAnimation(fig, partial(update), frames=43, interval=1)
|
485 |
-
|
486 |
return plt, Rm, Ra, Emax, Emin, Vd, Tc, start_v
|
487 |
|
488 |
def pvloop_simulator_plot_only(Rm, Ra, Emax, Emin, Vd, Tc, start_v):
|
489 |
plot,_,_,_,_,_,_,_ =pvloop_simulator(Rm, Ra, Emax, Emin, Vd, Tc, start_v)
|
|
|
490 |
return plot
|
491 |
|
492 |
## Demo
|
@@ -509,7 +510,8 @@ def generate_example():
|
|
509 |
|
510 |
plot, Rm, Ra, Emax, Emin, Vd,Tc, start_v = pvloop_simulator(Rm=round(results[4].item(),2), Ra=round(results[5].item(),2), Emax=results[2].item(), Emin=round(results[3].item(),2), Vd=round(results[6].item(),2), Tc=round(results[0].item(),2), start_v=round(results[1].item(),2))
|
511 |
video = video.replace("avi", "mp4")
|
512 |
-
|
|
|
513 |
|
514 |
title = "Physics-informed self-supervised learning for predicting cardiac digital twins with echocardiography"
|
515 |
|
@@ -535,7 +537,7 @@ with gr.Blocks() as demo:
|
|
535 |
generate_button = gr.Button("Load sample echocardiogram and generate result")
|
536 |
with gr.Row():
|
537 |
video = gr.PlayableVideo() #format="avi"
|
538 |
-
plot = gr.
|
539 |
|
540 |
with gr.Row():
|
541 |
Rm = gr.Number(label="Mitral valve circuit resistance (Rm) mmHg*s/ml:")
|
|
|
482 |
ax.plot(x, y, lw=1, c='b')
|
483 |
|
484 |
anim = animation.FuncAnimation(fig, partial(update), frames=43, interval=1)
|
485 |
+
anim.save("prediction.mp4")
|
486 |
return plt, Rm, Ra, Emax, Emin, Vd, Tc, start_v
|
487 |
|
488 |
def pvloop_simulator_plot_only(Rm, Ra, Emax, Emin, Vd, Tc, start_v):
|
489 |
plot,_,_,_,_,_,_,_ =pvloop_simulator(Rm, Ra, Emax, Emin, Vd, Tc, start_v)
|
490 |
+
fig.suptitle('Simulated PI-SSL LV Pressure Volume Loop', fontsize=16)
|
491 |
return plot
|
492 |
|
493 |
## Demo
|
|
|
510 |
|
511 |
plot, Rm, Ra, Emax, Emin, Vd,Tc, start_v = pvloop_simulator(Rm=round(results[4].item(),2), Ra=round(results[5].item(),2), Emax=results[2].item(), Emin=round(results[3].item(),2), Vd=round(results[6].item(),2), Tc=round(results[0].item(),2), start_v=round(results[1].item(),2))
|
512 |
video = video.replace("avi", "mp4")
|
513 |
+
animated = "prediction.mp4"
|
514 |
+
return video, animated, Rm, Ra, Emax, Emin, Vd, Tc, start_v
|
515 |
|
516 |
title = "Physics-informed self-supervised learning for predicting cardiac digital twins with echocardiography"
|
517 |
|
|
|
537 |
generate_button = gr.Button("Load sample echocardiogram and generate result")
|
538 |
with gr.Row():
|
539 |
video = gr.PlayableVideo() #format="avi"
|
540 |
+
plot = gr.PlayableVideo()
|
541 |
|
542 |
with gr.Row():
|
543 |
Rm = gr.Number(label="Mitral valve circuit resistance (Rm) mmHg*s/ml:")
|
app.py
CHANGED
@@ -482,11 +482,12 @@ def pvloop_simulator(Rm, Ra, Emax, Emin, Vd, Tc, start_v):
|
|
482 |
ax.plot(x, y, lw=1, c='b')
|
483 |
|
484 |
anim = animation.FuncAnimation(fig, partial(update), frames=43, interval=1)
|
485 |
-
|
486 |
return plt, Rm, Ra, Emax, Emin, Vd, Tc, start_v
|
487 |
|
488 |
def pvloop_simulator_plot_only(Rm, Ra, Emax, Emin, Vd, Tc, start_v):
|
489 |
plot,_,_,_,_,_,_,_ =pvloop_simulator(Rm, Ra, Emax, Emin, Vd, Tc, start_v)
|
|
|
490 |
return plot
|
491 |
|
492 |
## Demo
|
@@ -509,7 +510,8 @@ def generate_example():
|
|
509 |
|
510 |
plot, Rm, Ra, Emax, Emin, Vd,Tc, start_v = pvloop_simulator(Rm=round(results[4].item(),2), Ra=round(results[5].item(),2), Emax=results[2].item(), Emin=round(results[3].item(),2), Vd=round(results[6].item(),2), Tc=round(results[0].item(),2), start_v=round(results[1].item(),2))
|
511 |
video = video.replace("avi", "mp4")
|
512 |
-
|
|
|
513 |
|
514 |
title = "Physics-informed self-supervised learning for predicting cardiac digital twins with echocardiography"
|
515 |
|
@@ -535,7 +537,7 @@ with gr.Blocks() as demo:
|
|
535 |
generate_button = gr.Button("Load sample echocardiogram and generate result")
|
536 |
with gr.Row():
|
537 |
video = gr.PlayableVideo() #format="avi"
|
538 |
-
plot = gr.
|
539 |
|
540 |
with gr.Row():
|
541 |
Rm = gr.Number(label="Mitral valve circuit resistance (Rm) mmHg*s/ml:")
|
|
|
482 |
ax.plot(x, y, lw=1, c='b')
|
483 |
|
484 |
anim = animation.FuncAnimation(fig, partial(update), frames=43, interval=1)
|
485 |
+
anim.save("prediction.mp4")
|
486 |
return plt, Rm, Ra, Emax, Emin, Vd, Tc, start_v
|
487 |
|
488 |
def pvloop_simulator_plot_only(Rm, Ra, Emax, Emin, Vd, Tc, start_v):
|
489 |
plot,_,_,_,_,_,_,_ =pvloop_simulator(Rm, Ra, Emax, Emin, Vd, Tc, start_v)
|
490 |
+
fig.suptitle('Simulated PI-SSL LV Pressure Volume Loop', fontsize=16)
|
491 |
return plot
|
492 |
|
493 |
## Demo
|
|
|
510 |
|
511 |
plot, Rm, Ra, Emax, Emin, Vd,Tc, start_v = pvloop_simulator(Rm=round(results[4].item(),2), Ra=round(results[5].item(),2), Emax=results[2].item(), Emin=round(results[3].item(),2), Vd=round(results[6].item(),2), Tc=round(results[0].item(),2), start_v=round(results[1].item(),2))
|
512 |
video = video.replace("avi", "mp4")
|
513 |
+
animated = "prediction.mp4"
|
514 |
+
return video, animated, Rm, Ra, Emax, Emin, Vd, Tc, start_v
|
515 |
|
516 |
title = "Physics-informed self-supervised learning for predicting cardiac digital twins with echocardiography"
|
517 |
|
|
|
537 |
generate_button = gr.Button("Load sample echocardiogram and generate result")
|
538 |
with gr.Row():
|
539 |
video = gr.PlayableVideo() #format="avi"
|
540 |
+
plot = gr.PlayableVideo()
|
541 |
|
542 |
with gr.Row():
|
543 |
Rm = gr.Number(label="Mitral valve circuit resistance (Rm) mmHg*s/ml:")
|