Franny Dean commited on
Commit
9486ce6
·
1 Parent(s): 00831c5

echo in html also

Browse files
Files changed (2) hide show
  1. .ipynb_checkpoints/app-checkpoint.py +3 -2
  2. app.py +3 -2
.ipynb_checkpoints/app-checkpoint.py CHANGED
@@ -770,7 +770,8 @@ 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 = video.replace("avi", "mp4")
 
774
  animated = "<img src='prediction.gif' alt='pv_loop'>" # "prediction.gif" # style="width:48px;height:48px;"
775
  return video, animated, Rm, Ra, Emax, Emin, Vd, Tc, start_v
776
 
@@ -852,7 +853,7 @@ with gr.Blocks() as demo:
852
 
853
  generate_button = gr.Button("Load sample echocardiogram and generate result")
854
  with gr.Row():
855
- video = gr.PlayableVideo(autoplay=True) #format="avi"
856
  plot = gr.HTML() # gr.PlayableVideo(autoplay=True)
857
 
858
  with gr.Row():
 
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
 
 
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():
app.py CHANGED
@@ -770,7 +770,8 @@ 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 = video.replace("avi", "mp4")
 
774
  animated = "<img src='prediction.gif' alt='pv_loop'>" # "prediction.gif" # style="width:48px;height:48px;"
775
  return video, animated, Rm, Ra, Emax, Emin, Vd, Tc, start_v
776
 
@@ -852,7 +853,7 @@ with gr.Blocks() as demo:
852
 
853
  generate_button = gr.Button("Load sample echocardiogram and generate result")
854
  with gr.Row():
855
- video = gr.PlayableVideo(autoplay=True) #format="avi"
856
  plot = gr.HTML() # gr.PlayableVideo(autoplay=True)
857
 
858
  with gr.Row():
 
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
 
 
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():