Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,6 +22,8 @@ import gradio as gr
|
|
| 22 |
import argparse
|
| 23 |
|
| 24 |
import numpy as np
|
|
|
|
|
|
|
| 25 |
import torch
|
| 26 |
from torch.nn import functional as F
|
| 27 |
import torchvision
|
|
@@ -290,10 +292,13 @@ def infer(prompt,video_in, trim_value):
|
|
| 290 |
print("set stop frames to: " + str(n_frame))
|
| 291 |
|
| 292 |
for i in frames_list[0:int(n_frame)]:
|
| 293 |
-
|
| 294 |
#need to convert to numpy
|
|
|
|
|
|
|
|
|
|
| 295 |
|
| 296 |
-
matte_img = run_grounded_sam(
|
| 297 |
#print(pix2pix_img)
|
| 298 |
#image = Image.open(pix2pix_img)
|
| 299 |
#rgb_im = image.convert("RGB")
|
|
|
|
| 22 |
import argparse
|
| 23 |
|
| 24 |
import numpy as np
|
| 25 |
+
from PIL import image
|
| 26 |
+
from moviepy.editor import *
|
| 27 |
import torch
|
| 28 |
from torch.nn import functional as F
|
| 29 |
import torchvision
|
|
|
|
| 292 |
print("set stop frames to: " + str(n_frame))
|
| 293 |
|
| 294 |
for i in frames_list[0:int(n_frame)]:
|
| 295 |
+
to_numpy_i = Image.open(i).convert("RGB")
|
| 296 |
#need to convert to numpy
|
| 297 |
+
# Convert the image to a NumPy array
|
| 298 |
+
image_array = np.array(to_numpy_i)
|
| 299 |
+
|
| 300 |
|
| 301 |
+
matte_img = run_grounded_sam(image_array, text_prompt, task_type, background_prompt, background_type, box_threshold, text_threshold, iou_threshold, scribble_mode, guidance_mode):
|
| 302 |
#print(pix2pix_img)
|
| 303 |
#image = Image.open(pix2pix_img)
|
| 304 |
#rgb_im = image.convert("RGB")
|