Franny Dean commited on
Commit
5fce854
2 Parent(s): 70778a9 dfc20a1

Merge branch 'main' of hf.co:spaces/frances-dean/CardioPINN

Browse files

Merge

filenames <- str_replace(list.files("/Users/FDean/Desktop/Physics_Informed_Transfer_Learning/CardioPINN/EchoNet-Dynamic/Videos", full.names=FALSE),
'.mp4', '.avi')filenames <- str_replace(list.files("/Users/FDean/Desktop/Physics_Informed_Transfer_Learning/CardioPINN/EchoNet-Dynamic/Videos", full.names=FALSE),
filenames <- str_replace(list.files("/Users/FDean/Desktop/Physics_Informed_Transfer_Learning/CardioPINN/EchoNet-Dynamic/Videos", full.names=FALSE),
'.mp4', '.avi')ZLines starting with '#' will be ignored, and an empty message aborts

Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -454,8 +454,8 @@ def pvloop_simulator(Rm, Ra, Emax, Emin, Vd, Tc, start_v):
454
 
455
  # Create the figure and the loop that we will manipulate
456
  fig, ax = plt.subplots()
457
- plt.ylim((0,280))
458
- plt.xlim((0,280))
459
  line = ax.plot(volumes[(N-2)*60000:(N)*60000], pressures[(N-2)*60000:(N)*60000], lw=1)
460
  #print(line)
461
  line = line[0]
@@ -492,7 +492,7 @@ def generate_example():
492
  results = model(val_tensor)
493
 
494
  plot, Rm, Ra, Emax, Emin, Vd,Tc, start_v = pvloop_simulator(Rm=round(results[0][4].item(),2), Ra=round(results[0][5].item(),2), Emax=results[0][2].item(), Emin=round(results[0][3].item(),2), Vd=round(results[0][6].item(),2), Tc=round(results[0][0].item(),2), start_v=round(results[0][1].item(),2))
495
-
496
  return video, plot, Rm, Ra, Emax, Emin, Vd, Tc, start_v
497
 
498
  title = "Physics-informed self-supervised learning for predicting cardiac digital twins with echocardiography"
@@ -518,7 +518,7 @@ with gr.Blocks() as demo:
518
 
519
  generate_button = gr.Button("Load sample echocardiogram and generate result")
520
  with gr.Row():
521
- video = gr.PlayableVideo(format="avi")
522
  plot = gr.Plot()
523
 
524
  with gr.Row():
 
454
 
455
  # Create the figure and the loop that we will manipulate
456
  fig, ax = plt.subplots()
457
+ plt.ylim((0,180))
458
+ plt.xlim((0,160))
459
  line = ax.plot(volumes[(N-2)*60000:(N)*60000], pressures[(N-2)*60000:(N)*60000], lw=1)
460
  #print(line)
461
  line = line[0]
 
492
  results = model(val_tensor)
493
 
494
  plot, Rm, Ra, Emax, Emin, Vd,Tc, start_v = pvloop_simulator(Rm=round(results[0][4].item(),2), Ra=round(results[0][5].item(),2), Emax=results[0][2].item(), Emin=round(results[0][3].item(),2), Vd=round(results[0][6].item(),2), Tc=round(results[0][0].item(),2), start_v=round(results[0][1].item(),2))
495
+ video = video.replace("avi", "mp4")
496
  return video, plot, Rm, Ra, Emax, Emin, Vd, Tc, start_v
497
 
498
  title = "Physics-informed self-supervised learning for predicting cardiac digital twins with echocardiography"
 
518
 
519
  generate_button = gr.Button("Load sample echocardiogram and generate result")
520
  with gr.Row():
521
+ video = gr.PlayableVideo() #format="avi"
522
  plot = gr.Plot()
523
 
524
  with gr.Row():