Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -23,21 +23,9 @@ model = snapshot_download(repo_id="akhaliq/frame-interpolation-film-style")
|
|
23 |
|
24 |
interpolator = interpolator.Interpolator(model, None)
|
25 |
|
26 |
-
def resize(img):
|
27 |
-
basewidth = 300
|
28 |
-
img = Image.open(img)
|
29 |
-
wpercent = (basewidth/float(img.size[0]))
|
30 |
-
hsize = int((float(img.size[1])*float(wpercent)))
|
31 |
-
img = img.resize((basewidth,hsize), Image.ANTIALIAS)
|
32 |
-
return img
|
33 |
|
34 |
def predict(frame1, frame2, times_to_interpolate):
|
35 |
-
|
36 |
-
frame1 = resize(frame1)
|
37 |
-
frame2 = resize(frame2)
|
38 |
-
frame1 = frame1.save("test1.png")
|
39 |
-
frame2 = frame2.save("test2.png")
|
40 |
-
|
41 |
|
42 |
input_frames = [str(frame1), str(frame2)]
|
43 |
|
@@ -54,4 +42,4 @@ title="frame-interpolation"
|
|
54 |
description="Gradio demo for FILM: Frame Interpolation for Large Scene Motion. To use it, simply upload your images and add the times to interpolate number or click on one of the examples to load them. Read more at the links below."
|
55 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2202.04901' target='_blank'>FILM: Frame Interpolation for Large Motion</a> | <a href='https://github.com/google-research/frame-interpolation' target='_blank'>Github Repo</a></p>"
|
56 |
examples=[['one.png','two.png',2]]
|
57 |
-
gr.Interface(predict,[gr.inputs.Image(type='filepath'),gr.inputs.Image(type='filepath'),gr.inputs.Slider(minimum=2,maximum=5,step=1)],"playable_video",title=title,description=description,article=article,examples=examples).launch(enable_queue=True)
|
|
|
23 |
|
24 |
interpolator = interpolator.Interpolator(model, None)
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
def predict(frame1, frame2, times_to_interpolate):
|
28 |
+
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
input_frames = [str(frame1), str(frame2)]
|
31 |
|
|
|
42 |
description="Gradio demo for FILM: Frame Interpolation for Large Scene Motion. To use it, simply upload your images and add the times to interpolate number or click on one of the examples to load them. Read more at the links below."
|
43 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2202.04901' target='_blank'>FILM: Frame Interpolation for Large Motion</a> | <a href='https://github.com/google-research/frame-interpolation' target='_blank'>Github Repo</a></p>"
|
44 |
examples=[['one.png','two.png',2]]
|
45 |
+
gr.Interface(predict,[gr.inputs.Image(type='filepath',shape=(512,512)),gr.inputs.Image(type='filepath',shape=(512,512)),gr.inputs.Slider(minimum=2,maximum=5,step=1)],"playable_video",title=title,description=description,article=article,examples=examples).launch(enable_queue=True)
|