Spaces:
Configuration error
Configuration error
Commit
·
2119517
1
Parent(s):
200a65d
completed demo
Browse files- florence_sam/app.py +1 -4
- florence_sam/main.py +1 -0
florence_sam/app.py
CHANGED
@@ -4,17 +4,13 @@ import gradio as gr
|
|
4 |
import os
|
5 |
|
6 |
def pre_processor(video_path, scale_factor, prompt, crop_duration):
|
7 |
-
# Load video with moviepy
|
8 |
video = mp.VideoFileClip(video_path)
|
9 |
|
10 |
-
# Crop video to the specified duration (in seconds)
|
11 |
cropped_video = video.subclip(0, min(crop_duration, video.duration))
|
12 |
|
13 |
-
# Save the cropped video to a temporary file
|
14 |
temp_output = "cropped_video.mp4"
|
15 |
cropped_video.write_videofile(temp_output, codec="libx264")
|
16 |
|
17 |
-
# Pass the cropped video and other parameters to the infer function
|
18 |
output = infer(temp_output, scale_factor, prompt)
|
19 |
|
20 |
# Clean up temporary files
|
@@ -25,6 +21,7 @@ def pre_processor(video_path, scale_factor, prompt, crop_duration):
|
|
25 |
|
26 |
|
27 |
demo = gr.Interface(
|
|
|
28 |
fn=pre_processor,
|
29 |
inputs=[
|
30 |
gr.Video(label="Upload Video"),
|
|
|
4 |
import os
|
5 |
|
6 |
def pre_processor(video_path, scale_factor, prompt, crop_duration):
|
|
|
7 |
video = mp.VideoFileClip(video_path)
|
8 |
|
|
|
9 |
cropped_video = video.subclip(0, min(crop_duration, video.duration))
|
10 |
|
|
|
11 |
temp_output = "cropped_video.mp4"
|
12 |
cropped_video.write_videofile(temp_output, codec="libx264")
|
13 |
|
|
|
14 |
output = infer(temp_output, scale_factor, prompt)
|
15 |
|
16 |
# Clean up temporary files
|
|
|
21 |
|
22 |
|
23 |
demo = gr.Interface(
|
24 |
+
title="Text based video inpainting",
|
25 |
fn=pre_processor,
|
26 |
inputs=[
|
27 |
gr.Video(label="Upload Video"),
|
florence_sam/main.py
CHANGED
@@ -30,6 +30,7 @@ def infer(video_path, scale_factor, prompt):
|
|
30 |
|
31 |
# remove intermediate files
|
32 |
shutil.rmtree("tmp")
|
|
|
33 |
|
34 |
return "results/input_frames/inpaint_out.mp4"
|
35 |
|
|
|
30 |
|
31 |
# remove intermediate files
|
32 |
shutil.rmtree("tmp")
|
33 |
+
torch.cuda.empty_cache()
|
34 |
|
35 |
return "results/input_frames/inpaint_out.mp4"
|
36 |
|