Spaces:
Running
Running
change gradio matte api behavior
Browse files
app.py
CHANGED
|
@@ -6,11 +6,12 @@ import cv2
|
|
| 6 |
from PIL import Image
|
| 7 |
from moviepy.editor import *
|
| 8 |
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
|
| 9 |
-
|
| 10 |
import gradio as gr
|
| 11 |
|
|
|
|
| 12 |
|
| 13 |
-
matte_client = Client("
|
| 14 |
|
| 15 |
# execute a CLI command
|
| 16 |
def execute_command(command: str) -> None:
|
|
@@ -160,11 +161,12 @@ def get_frames(video_in, img_type):
|
|
| 160 |
|
| 161 |
def get_matte(video_in, subject_to_remove):
|
| 162 |
print("Trying to call video matting")
|
|
|
|
| 163 |
result = matte_client.predict(
|
| 164 |
-
|
| 165 |
-
10,
|
| 166 |
-
|
| 167 |
-
"",
|
| 168 |
api_name="/go_matte"
|
| 169 |
)
|
| 170 |
print(result)
|
|
|
|
| 6 |
from PIL import Image
|
| 7 |
from moviepy.editor import *
|
| 8 |
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
|
| 9 |
+
|
| 10 |
import gradio as gr
|
| 11 |
|
| 12 |
+
from gradio_client import Client, handle_file
|
| 13 |
|
| 14 |
+
matte_client = Client("fffiloni/Video-Matting-Anything")
|
| 15 |
|
| 16 |
# execute a CLI command
|
| 17 |
def execute_command(command: str) -> None:
|
|
|
|
| 161 |
|
| 162 |
def get_matte(video_in, subject_to_remove):
|
| 163 |
print("Trying to call video matting")
|
| 164 |
+
|
| 165 |
result = matte_client.predict(
|
| 166 |
+
video_in={"video":handle_file(video_in)},
|
| 167 |
+
trim_value=10,
|
| 168 |
+
prompt=subject_to_remove,
|
| 169 |
+
background_prompt="",
|
| 170 |
api_name="/go_matte"
|
| 171 |
)
|
| 172 |
print(result)
|