fffiloni commited on
Commit
7d4aba6
·
1 Parent(s): e5796a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  import numpy as np
3
  from PIL import Image
 
4
  from share_btn import community_icon_html, loading_icon_html, share_js
5
  import torch
6
  from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
@@ -15,7 +16,13 @@ pipe_xl.to("cuda")
15
 
16
  def infer(prompt, video_in):
17
 
18
- video = [Image.fromarray(frame).resize((1024, 576)) for frame in video_in]
 
 
 
 
 
 
19
  #del pipe
20
  #pipe_xl.to("cuda")
21
  video_frames = pipe_xl(prompt, video=video, strength=0.6).frames
@@ -102,7 +109,7 @@ with gr.Blocks(css=css) as demo:
102
  """
103
  )
104
 
105
- video_in = gr.Video(type="numpy", source="upload")
106
  prompt_in = gr.Textbox(label="Prompt", placeholder="Darth Vader is surfing on waves", elem_id="prompt-in")
107
  #inference_steps = gr.Slider(label="Inference Steps", minimum=10, maximum=100, step=1, value=40, interactive=False)
108
  submit_btn = gr.Button("Submit")
 
1
  import gradio as gr
2
  import numpy as np
3
  from PIL import Image
4
+ from moviepy.editor import VideoFileClip
5
  from share_btn import community_icon_html, loading_icon_html, share_js
6
  import torch
7
  from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
 
16
 
17
  def infer(prompt, video_in):
18
 
19
+ # Load the input video
20
+ clip = VideoFileClip(video_in)
21
+
22
+ # Convert the video to the desired format
23
+ clip.write_videofile("video.mkv")
24
+
25
+ video = [Image.fromarray(frame).resize((1024, 576)) for frame in "video.mkv"]
26
  #del pipe
27
  #pipe_xl.to("cuda")
28
  video_frames = pipe_xl(prompt, video=video, strength=0.6).frames
 
109
  """
110
  )
111
 
112
+ video_in = gr.Video(type="filepath", source="upload")
113
  prompt_in = gr.Textbox(label="Prompt", placeholder="Darth Vader is surfing on waves", elem_id="prompt-in")
114
  #inference_steps = gr.Slider(label="Inference Steps", minimum=10, maximum=100, step=1, value=40, interactive=False)
115
  submit_btn = gr.Button("Submit")