Franny Dean commited on
Commit
3e750a2
·
1 Parent(s): 9486ce6

hugging face got too stressed back to video

Browse files
Files changed (2) hide show
  1. .ipynb_checkpoints/app-checkpoint.py +6 -6
  2. app.py +6 -6
.ipynb_checkpoints/app-checkpoint.py CHANGED
@@ -486,7 +486,7 @@ def pvloop_simulator(Rm, Ra, Emax, Emin, Vd, Tc, start_v, animate=True):
486
 
487
  if animate:
488
  anim = animation.FuncAnimation(fig, partial(update), frames=100, interval=30)
489
- anim.save("prediction.gif")
490
 
491
  return plt, Rm, Ra, Emax, Emin, Vd, Tc, start_v
492
 
@@ -770,9 +770,9 @@ def generate_example():
770
  video = f"EchoNet-Dynamic/Videos/{filename}"
771
 
772
  plot, Rm, Ra, Emax, Emin, Vd,Tc, start_v = pvloop_simulator(Rm=round(results[4].item(),2), Ra=round(results[5].item(),2), Emax=round(results[2].item(),2), 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))
773
- video_file = video.replace("avi", "mp4")
774
- video = "<video autoplay loop muted> <source src=video_file type='video/mp4'/> </video>"
775
- animated = "<img src='prediction.gif' alt='pv_loop'>" # "prediction.gif" # style="width:48px;height:48px;"
776
  return video, animated, Rm, Ra, Emax, Emin, Vd, Tc, start_v
777
 
778
 
@@ -853,8 +853,8 @@ with gr.Blocks() as demo:
853
 
854
  generate_button = gr.Button("Load sample echocardiogram and generate result")
855
  with gr.Row():
856
- video = gr.HTML() # PlayableVideo(autoplay=True) #format="avi"
857
- plot = gr.HTML() # gr.PlayableVideo(autoplay=True)
858
 
859
  with gr.Row():
860
  Rm = gr.Number(label="Mitral valve circuit resistance (Rm) mmHg*s/ml:")
 
486
 
487
  if animate:
488
  anim = animation.FuncAnimation(fig, partial(update), frames=100, interval=30)
489
+ anim.save("prediction.mp4")
490
 
491
  return plt, Rm, Ra, Emax, Emin, Vd, Tc, start_v
492
 
 
770
  video = f"EchoNet-Dynamic/Videos/{filename}"
771
 
772
  plot, Rm, Ra, Emax, Emin, Vd,Tc, start_v = pvloop_simulator(Rm=round(results[4].item(),2), Ra=round(results[5].item(),2), Emax=round(results[2].item(),2), 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))
773
+ video = video.replace("avi", "mp4")
774
+ #video = "<video autoplay loop muted> <source src=video_file type='video/mp4'/> </video>"
775
+ animated = "prediction.mp4" # style="width:48px;height:48px;" # "<img src='prediction.gif' alt='pv_loop'>"
776
  return video, animated, Rm, Ra, Emax, Emin, Vd, Tc, start_v
777
 
778
 
 
853
 
854
  generate_button = gr.Button("Load sample echocardiogram and generate result")
855
  with gr.Row():
856
+ video = gr.PlayableVideo(autoplay=True) #format="avi" gr.HTML()
857
+ plot = gr.PlayableVideo(autoplay=True) # gr.HTML() #
858
 
859
  with gr.Row():
860
  Rm = gr.Number(label="Mitral valve circuit resistance (Rm) mmHg*s/ml:")
app.py CHANGED
@@ -486,7 +486,7 @@ def pvloop_simulator(Rm, Ra, Emax, Emin, Vd, Tc, start_v, animate=True):
486
 
487
  if animate:
488
  anim = animation.FuncAnimation(fig, partial(update), frames=100, interval=30)
489
- anim.save("prediction.gif")
490
 
491
  return plt, Rm, Ra, Emax, Emin, Vd, Tc, start_v
492
 
@@ -770,9 +770,9 @@ def generate_example():
770
  video = f"EchoNet-Dynamic/Videos/{filename}"
771
 
772
  plot, Rm, Ra, Emax, Emin, Vd,Tc, start_v = pvloop_simulator(Rm=round(results[4].item(),2), Ra=round(results[5].item(),2), Emax=round(results[2].item(),2), 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))
773
- video_file = video.replace("avi", "mp4")
774
- video = "<video autoplay loop muted> <source src=video_file type='video/mp4'/> </video>"
775
- animated = "<img src='prediction.gif' alt='pv_loop'>" # "prediction.gif" # style="width:48px;height:48px;"
776
  return video, animated, Rm, Ra, Emax, Emin, Vd, Tc, start_v
777
 
778
 
@@ -853,8 +853,8 @@ with gr.Blocks() as demo:
853
 
854
  generate_button = gr.Button("Load sample echocardiogram and generate result")
855
  with gr.Row():
856
- video = gr.HTML() # PlayableVideo(autoplay=True) #format="avi"
857
- plot = gr.HTML() # gr.PlayableVideo(autoplay=True)
858
 
859
  with gr.Row():
860
  Rm = gr.Number(label="Mitral valve circuit resistance (Rm) mmHg*s/ml:")
 
486
 
487
  if animate:
488
  anim = animation.FuncAnimation(fig, partial(update), frames=100, interval=30)
489
+ anim.save("prediction.mp4")
490
 
491
  return plt, Rm, Ra, Emax, Emin, Vd, Tc, start_v
492
 
 
770
  video = f"EchoNet-Dynamic/Videos/{filename}"
771
 
772
  plot, Rm, Ra, Emax, Emin, Vd,Tc, start_v = pvloop_simulator(Rm=round(results[4].item(),2), Ra=round(results[5].item(),2), Emax=round(results[2].item(),2), 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))
773
+ video = video.replace("avi", "mp4")
774
+ #video = "<video autoplay loop muted> <source src=video_file type='video/mp4'/> </video>"
775
+ animated = "prediction.mp4" # style="width:48px;height:48px;" # "<img src='prediction.gif' alt='pv_loop'>"
776
  return video, animated, Rm, Ra, Emax, Emin, Vd, Tc, start_v
777
 
778
 
 
853
 
854
  generate_button = gr.Button("Load sample echocardiogram and generate result")
855
  with gr.Row():
856
+ video = gr.PlayableVideo(autoplay=True) #format="avi" gr.HTML()
857
+ plot = gr.PlayableVideo(autoplay=True) # gr.HTML() #
858
 
859
  with gr.Row():
860
  Rm = gr.Number(label="Mitral valve circuit resistance (Rm) mmHg*s/ml:")