fffiloni commited on
Commit
54a7442
1 Parent(s): 15a078f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -123,7 +123,9 @@ def infer():
123
 
124
  #frames, _, _ = read_video(str("./spacex.mp4"), output_format="TCHW")
125
  #print(f"FRAME BEFORE stack: {frames[100]}")
 
126
  prompt = "astronaut crew inside a spaceship, artwork by Claude Monet, beautiful details"
 
127
  pil2diff_img = Image.open("./frame1.jpg")
128
  canny_image = get_canny_filter(pil2diff_img)
129
  diffused_img = generate_images(prompt, canny_image)
@@ -136,9 +138,9 @@ def infer():
136
 
137
  canny_image.save("canny1.jpg")
138
  canny_image2.save("canny2.jpg")
139
- input_frame_1 = read_image(str("canny1.jpg"), ImageReadMode.UNCHANGED)
140
  print(f"FRAME 1: {input_frame_1}")
141
- input_frame_2 = read_image(str("canny2.jpg"), ImageReadMode.UNCHANGED)
142
  print(f"FRAME 1: {input_frame_2}")
143
 
144
  #img1_batch = torch.stack([frames[0]])
@@ -271,12 +273,12 @@ def infer():
271
  blend2 = Image.blend(res,blend2,0.5)
272
  blend2.save("blended2.jpg")
273
 
274
- pil2diff_img = Image.open("blended2.jpg")
275
- canny_image = get_canny_filter(pil2diff_img)
276
- diffused_img = generate_images(prompt, canny_image)
277
- print(f"DIFFUSED IMG: {diffused_img[1]}")
278
 
279
- diffused_img[1].save("diffused_blended_2.jpg")
280
 
281
  return "done", "predicted_flow.jpg", ["flofile.flo"], "diffused_input1.jpg", "diffused_blended_2.jpg", 'wraped.jpg', "blended2.jpg"
282
  ####################################
 
123
 
124
  #frames, _, _ = read_video(str("./spacex.mp4"), output_format="TCHW")
125
  #print(f"FRAME BEFORE stack: {frames[100]}")
126
+
127
  prompt = "astronaut crew inside a spaceship, artwork by Claude Monet, beautiful details"
128
+
129
  pil2diff_img = Image.open("./frame1.jpg")
130
  canny_image = get_canny_filter(pil2diff_img)
131
  diffused_img = generate_images(prompt, canny_image)
 
138
 
139
  canny_image.save("canny1.jpg")
140
  canny_image2.save("canny2.jpg")
141
+ input_frame_1 = read_image(str("diffused_input1.jpg"), ImageReadMode.UNCHANGED)
142
  print(f"FRAME 1: {input_frame_1}")
143
+ input_frame_2 = read_image(str("./frame2.jpg"), ImageReadMode.UNCHANGED)
144
  print(f"FRAME 1: {input_frame_2}")
145
 
146
  #img1_batch = torch.stack([frames[0]])
 
273
  blend2 = Image.blend(res,blend2,0.5)
274
  blend2.save("blended2.jpg")
275
 
276
+ pil2diff_blend = Image.open("blended2.jpg")
277
+ canny_image = get_canny_filter(pil2diff_blend)
278
+ diffused_blend = generate_images(prompt, canny_image)
279
+ print(f"DIFFUSED IMG: {diffused_blend[1]}")
280
 
281
+ diffused_blend[1].save("diffused_blended_2.jpg")
282
 
283
  return "done", "predicted_flow.jpg", ["flofile.flo"], "diffused_input1.jpg", "diffused_blended_2.jpg", 'wraped.jpg', "blended2.jpg"
284
  ####################################