fffiloni commited on
Commit
204cb05
β€’
1 Parent(s): 646e93c

Rename dev.py to app.py

Browse files
Files changed (1) hide show
  1. dev.py β†’ app.py +18 -1
dev.py β†’ app.py RENAMED
@@ -1,5 +1,12 @@
 
1
  from diffusers.utils import load_image
2
 
 
 
 
 
 
 
3
  def get_canny_filter(image):
4
  image = load_image(image)
5
 
@@ -12,4 +19,14 @@ def get_canny_filter(image):
12
  image = image[:, :, None]
13
  image = np.concatenate([image, image, image], axis=2)
14
  image = Image.fromarray(image)
15
- return image
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
  from diffusers.utils import load_image
3
 
4
+ import os
5
+ import cv2
6
+ import numpy as np
7
+ from PIL import Image
8
+ from moviepy.editor import *
9
+
10
  def get_canny_filter(image):
11
  image = load_image(image)
12
 
 
19
  image = image[:, :, None]
20
  image = np.concatenate([image, image, image], axis=2)
21
  image = Image.fromarray(image)
22
+ return image
23
+
24
+ def infer(imported_gif):
25
+ clip = VideoFileClip(imported_gif.name)
26
+ clip.write_videofile("my_gif_video.mp4")
27
+
28
+ return "my_gif_video.mp4"
29
+
30
+ inputs = [gr.File(label="import a GIF instead", file_types=['.gif'])]
31
+ outputs = [gr.Video()]
32
+ gr.Interface(fn=infer, inputs=inputs, outputs=outputs).launch()