frances-dean commited on
Commit
11e40e8
1 Parent(s): 1a803ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -482,16 +482,19 @@ def generate_example():
482
  # get random input
483
  data_path = 'EchoNet-Dynamic'
484
  image_data = Echo(root = data_path, split = 'all', target_type=['Filename','LargeIndex','SmallIndex'])
485
- image_loaded_data = DataLoader(image_data, batch_size=1, shuffle=True)
486
  val_data = next(iter(image_loaded_data))
487
  #create_echo_clip(val_data,'test')
488
  val_seq = val_data[0]
489
- filename = val_data[1][0][0]
490
- video = f"EchoNet-Dynamic/Videos/{filename}"
491
  val_tensor = torch.tensor(val_seq, dtype=torch.float32)
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
 
 
482
  # get random input
483
  data_path = 'EchoNet-Dynamic'
484
  image_data = Echo(root = data_path, split = 'all', target_type=['Filename','LargeIndex','SmallIndex'])
485
+ image_loaded_data = DataLoader(image_data, batch_size=30, shuffle=True)
486
  val_data = next(iter(image_loaded_data))
487
  #create_echo_clip(val_data,'test')
488
  val_seq = val_data[0]
489
+
 
490
  val_tensor = torch.tensor(val_seq, dtype=torch.float32)
491
+ n=random.randint(0, 29)
492
+ results = model(val_tensor)[n]
493
+
494
+ filename = val_data[1][0][n]
495
+ video = f"EchoNet-Dynamic/Videos/{filename}"
496
 
497
+ 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))
498
  video = video.replace("avi", "mp4")
499
  return video, plot, Rm, Ra, Emax, Emin, Vd, Tc, start_v
500