akhaliq HF staff commited on
Commit
c1e74d5
1 Parent(s): d24fd05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -23,11 +23,24 @@ model = snapshot_download(repo_id="akhaliq/frame-interpolation-film-style")
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
 
32
  frames = list(
33
  util.interpolate_recursively_from_files(
@@ -42,4 +55,4 @@ title="frame-interpolation"
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://film-net.github.io/' 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)
 
23
 
24
  interpolator = interpolator.Interpolator(model, None)
25
 
26
+ def resize(width,img):
27
+ basewidth = width
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(512,frame1)
37
+ frame2 = resize(512,frame2)
38
 
39
+ frame1.save("test1.png")
40
+ frame2.save("test2.png")
41
+
42
+
43
+ input_frames = ["test1.png", "test2.png"]
44
 
45
  frames = list(
46
  util.interpolate_recursively_from_files(
 
55
  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."
56
  article = "<p style='text-align: center'><a href='https://film-net.github.io/' target='_blank'>FILM: Frame Interpolation for Large Motion</a> | <a href='https://github.com/google-research/frame-interpolation' target='_blank'>Github Repo</a></p>"
57
  examples=[['one.png','two.png',2]]
58
+ 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)