File size: 1,981 Bytes
ce026c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1425010
ce026c7
 
 
 
 
 
 
 
 
 
 
1425010
 
 
ce026c7
 
 
 
 
1425010
 
ce026c7
 
 
 
 
 
 
 
1425010
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import os
os.system("git clone https://github.com/google-research/frame-interpolation")
import sys
sys.path.append("frame-interpolation")

import cv2
import numpy as np
import tensorflow as tf
import mediapy
from PIL import Image
from eval import interpolator, util
import gradio as gr

from huggingface_hub import snapshot_download

from image_tools.sizes import resize_and_crop
from moviepy.editor import *


model = snapshot_download(repo_id="akhaliq/frame-interpolation-film-style")

interpolator = interpolator.Interpolator(model, None)

ffmpeg_path = util.get_ffmpeg_path()
mediapy.set_ffmpeg(ffmpeg_path)


        
def interpolate(frame1, frame2, times_to_interpolate):
    
    input_frames = [frame1, frame2]

    frames = list(
        util.interpolate_recursively_from_files(
            input_frames, times_to_interpolate, interpolator))
    print(frames)  
   
    return "done"
    
    
    
title="sketch-frame-interpolation"
description="<p style='text-align: center'>This is a fork of the Gradio demo for FILM: Frame Interpolation for Large Scene Motion from @akhaliq, but using sketches instead of images. This could be very useful for the animation industry :) <br /> To use it, simply draw your sketches and add the times to interpolate number. Read more at the links below. <br /> <img id='visitor-badge' alt='visitor badge' src='https://visitor-badge.glitch.me/badge?page_id=gradio-blocks.sketch_frame_interpolation' style='display: inline-block'/></p>"
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>"
custom_css = "style.css"

gr.Interface(interpolate,[gr.Image(source="upload", type="filepath"),gr.Image(source="upload", type="filepath"),2],outputs=[gr.Textbox()],title=title,description=description,article=article,css=custom_css).launch(enable_queue=True)