fffiloni commited on
Commit
4399e27
1 Parent(s): 8658821

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -70,10 +70,10 @@ def magic_lama(img):
70
  inverted_mask = ImageOps.invert(mask)
71
 
72
 
73
- imageio.imwrite(f"./data/data_{i}.png", img)
74
- imageio.imwrite(f"./data/data_mask_{i}.png", inverted_mask)
75
  os.system('python predict.py model.path=/home/user/app/ indir=/home/user/app/data/ outdir=/home/user/app/dataout/ device=cpu')
76
- return f"./dataout/data_mask_{i}.png"
77
 
78
  def infer(video_in):
79
  # 1. break video into frames and get FPS
@@ -93,7 +93,9 @@ def infer(video_in):
93
 
94
  for i in frames_list[0:int(n_frame)]:
95
  lama_frame = magic_lama(i)
96
- result_frames.append(lama_frame)
 
 
97
  print("frame " + i + "/" + str(n_frame) + ": done;")
98
 
99
 
 
70
  inverted_mask = ImageOps.invert(mask)
71
 
72
 
73
+ imageio.imwrite(f"./data/data.png", img)
74
+ imageio.imwrite(f"./data/data_mask.png", inverted_mask)
75
  os.system('python predict.py model.path=/home/user/app/ indir=/home/user/app/data/ outdir=/home/user/app/dataout/ device=cpu')
76
+ return f"./dataout/data_mask.png"
77
 
78
  def infer(video_in):
79
  # 1. break video into frames and get FPS
 
93
 
94
  for i in frames_list[0:int(n_frame)]:
95
  lama_frame = magic_lama(i)
96
+ lama_frame = Image.open(lama_frame)
97
+ imageio.imwrite(f"cleaned_frame_{i}", lama_frame)
98
+ result_frames.append(f"cleaned_frame_{i}")
99
  print("frame " + i + "/" + str(n_frame) + ": done;")
100
 
101