Update app.py
Browse files
app.py
CHANGED
@@ -280,20 +280,20 @@ def infer():
|
|
280 |
print(res)
|
281 |
|
282 |
res = Image.fromarray(res)
|
283 |
-
res.save('
|
284 |
|
285 |
blend2 = Image.open('raw_frame2.jpg')
|
286 |
blend2 = Image.blend(res,blend2,0.5)
|
287 |
blend2.save("blended2.jpg")
|
288 |
|
289 |
-
pil2diff_blend = Image.open("
|
290 |
canny_image = get_canny_filter(pil2diff_blend)
|
291 |
diffused_blend = generate_images(prompt, canny_image, pil2diff_blend)
|
292 |
print(f"DIFFUSED IMG: {diffused_blend[1]}")
|
293 |
|
294 |
diffused_blend[1].save("diffused_blended_2.jpg")
|
295 |
|
296 |
-
return "done", "predicted_flow.jpg", ["flofile.flo"], "diffused_input1.jpg", "diffused_blended_2.jpg", '
|
297 |
####################################
|
298 |
# Bonus: Creating GIFs of predicted flows
|
299 |
# ---------------------------------------
|
@@ -322,4 +322,4 @@ def infer():
|
|
322 |
# ffmpeg -f image2 -framerate 30 -i predicted_flow_%d.jpg -loop -1 flow.gif
|
323 |
|
324 |
|
325 |
-
gr.Interface(fn=infer, inputs=[], outputs=[gr.Textbox(), gr.Image(label="flow"), gr.Files(), gr.Image(label="diffused input"), gr.Image(), gr.Image(label="
|
|
|
280 |
print(res)
|
281 |
|
282 |
res = Image.fromarray(res)
|
283 |
+
res.save('warped.jpg')
|
284 |
|
285 |
blend2 = Image.open('raw_frame2.jpg')
|
286 |
blend2 = Image.blend(res,blend2,0.5)
|
287 |
blend2.save("blended2.jpg")
|
288 |
|
289 |
+
pil2diff_blend = Image.open("warped.jpg")
|
290 |
canny_image = get_canny_filter(pil2diff_blend)
|
291 |
diffused_blend = generate_images(prompt, canny_image, pil2diff_blend)
|
292 |
print(f"DIFFUSED IMG: {diffused_blend[1]}")
|
293 |
|
294 |
diffused_blend[1].save("diffused_blended_2.jpg")
|
295 |
|
296 |
+
return "done", "predicted_flow.jpg", ["flofile.flo"], "diffused_input1.jpg", "diffused_blended_2.jpg", 'warped.jpg', "blended2.jpg"
|
297 |
####################################
|
298 |
# Bonus: Creating GIFs of predicted flows
|
299 |
# ---------------------------------------
|
|
|
322 |
# ffmpeg -f image2 -framerate 30 -i predicted_flow_%d.jpg -loop -1 flow.gif
|
323 |
|
324 |
|
325 |
+
gr.Interface(fn=infer, inputs=[], outputs=[gr.Textbox(), gr.Image(label="flow"), gr.Files(), gr.Image(label="diffused input"), gr.Image(), gr.Image(label="warped flow to img2"), gr.Image(label="blended result to diffuse")]).launch()
|