Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import gradio as gr
|
2 |
-
from gradio_imageslider import ImageSlider
|
3 |
from loadimg import load_img
|
4 |
import spaces
|
5 |
from transformers import AutoModelForImageSegmentation
|
@@ -25,7 +24,7 @@ transform_image = transforms.Compose(
|
|
25 |
]
|
26 |
)
|
27 |
|
28 |
-
|
29 |
def fn(vid):
|
30 |
# Load the video using moviepy
|
31 |
video = mp.VideoFileClip(vid)
|
@@ -53,7 +52,7 @@ def fn(vid):
|
|
53 |
return processed_video
|
54 |
|
55 |
|
56 |
-
|
57 |
def process(image):
|
58 |
image_size = image.size
|
59 |
input_images = transform_image(image).unsqueeze(0).to("cuda")
|
@@ -86,7 +85,6 @@ in_video = gr.Video(label="birefnet")
|
|
86 |
out_video = gr.Video()
|
87 |
|
88 |
|
89 |
-
url = "https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"
|
90 |
demo = gr.Interface(
|
91 |
fn, inputs=in_video, outputs=out_video, api_name="video"
|
92 |
)
|
|
|
1 |
import gradio as gr
|
|
|
2 |
from loadimg import load_img
|
3 |
import spaces
|
4 |
from transformers import AutoModelForImageSegmentation
|
|
|
24 |
]
|
25 |
)
|
26 |
|
27 |
+
@spaces.GPU
|
28 |
def fn(vid):
|
29 |
# Load the video using moviepy
|
30 |
video = mp.VideoFileClip(vid)
|
|
|
52 |
return processed_video
|
53 |
|
54 |
|
55 |
+
|
56 |
def process(image):
|
57 |
image_size = image.size
|
58 |
input_images = transform_image(image).unsqueeze(0).to("cuda")
|
|
|
85 |
out_video = gr.Video()
|
86 |
|
87 |
|
|
|
88 |
demo = gr.Interface(
|
89 |
fn, inputs=in_video, outputs=out_video, api_name="video"
|
90 |
)
|