fffiloni commited on
Commit
edc2ddc
·
1 Parent(s): ed4670c

added denoise strength option

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -52,11 +52,11 @@ def convert_mp4_to_frames(video_path, duration=3):
52
 
53
  return frames
54
 
55
- def infer(prompt, video_in):
56
 
57
  video = convert_mp4_to_frames(video_in, duration=3)
58
  video_resized = [Image.fromarray(frame).resize((1024, 576)) for frame in video]
59
- video_frames = pipe_xl(prompt, video=video_resized, strength=0.6).frames
60
  video_path = export_to_video(video_frames, output_video_path="xl_result.mp4")
61
 
62
  return "xl_result.mp4", gr.Group.update(visible=True)
@@ -145,6 +145,7 @@ with gr.Blocks(css=css) as demo:
145
 
146
  video_in = gr.Video(type="numpy", source="upload")
147
  prompt_in = gr.Textbox(label="Prompt", placeholder="This must be the same prompt you used for the original clip :)", elem_id="prompt-in")
 
148
  #inference_steps = gr.Slider(label="Inference Steps", minimum=10, maximum=100, step=1, value=40, interactive=False)
149
  submit_btn = gr.Button("Submit")
150
  video_result = gr.Video(label="Video Output", elem_id="video-output")
@@ -155,7 +156,7 @@ with gr.Blocks(css=css) as demo:
155
  share_button = gr.Button("Share to community", elem_id="share-btn")
156
 
157
  submit_btn.click(fn=infer,
158
- inputs=[prompt_in, video_in],
159
  outputs=[video_result, share_group])
160
 
161
  share_button.click(None, [], [], _js=share_js)
 
52
 
53
  return frames
54
 
55
+ def infer(prompt, video_in, denoise_strength):
56
 
57
  video = convert_mp4_to_frames(video_in, duration=3)
58
  video_resized = [Image.fromarray(frame).resize((1024, 576)) for frame in video]
59
+ video_frames = pipe_xl(prompt, video=video_resized, strength=denoise_strength).frames
60
  video_path = export_to_video(video_frames, output_video_path="xl_result.mp4")
61
 
62
  return "xl_result.mp4", gr.Group.update(visible=True)
 
145
 
146
  video_in = gr.Video(type="numpy", source="upload")
147
  prompt_in = gr.Textbox(label="Prompt", placeholder="This must be the same prompt you used for the original clip :)", elem_id="prompt-in")
148
+ denoise_strength = gr.Slider(label="Denoise strength", minimum=0.6, maximum=0.9, step=0.1, value=0.66)
149
  #inference_steps = gr.Slider(label="Inference Steps", minimum=10, maximum=100, step=1, value=40, interactive=False)
150
  submit_btn = gr.Button("Submit")
151
  video_result = gr.Video(label="Video Output", elem_id="video-output")
 
156
  share_button = gr.Button("Share to community", elem_id="share-btn")
157
 
158
  submit_btn.click(fn=infer,
159
+ inputs=[prompt_in, video_in, denoise_strength],
160
  outputs=[video_result, share_group])
161
 
162
  share_button.click(None, [], [], _js=share_js)