Spaces:
Running
Running
use blocks api
Browse files- app.py +19 -21
- requirements.txt +1 -1
app.py
CHANGED
@@ -1,10 +1,3 @@
|
|
1 |
-
import os
|
2 |
-
|
3 |
-
os.system("pip install gradio --upgrade")
|
4 |
-
os.system("pip install torch")
|
5 |
-
os.system("pip freeze")
|
6 |
-
|
7 |
-
|
8 |
import torch
|
9 |
import gradio as gr
|
10 |
|
@@ -33,18 +26,23 @@ def inference(video):
|
|
33 |
return "com.mp4"
|
34 |
|
35 |
|
36 |
-
title
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
|
42 |
-
gr.Interface(
|
43 |
-
inference,
|
44 |
-
gr.inputs.Video(label="Input"),
|
45 |
-
gr.outputs.Video(label="Output"),
|
46 |
-
title=title,
|
47 |
-
description=description,
|
48 |
-
article=article,
|
49 |
-
examples=examples,
|
50 |
-
).launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import torch
|
2 |
import gradio as gr
|
3 |
|
|
|
26 |
return "com.mp4"
|
27 |
|
28 |
|
29 |
+
with gr.Blocks(title="Robust Video Matting") as block:
|
30 |
+
gr.Markdown("# Robust Video Matting")
|
31 |
+
gr.Markdown(
|
32 |
+
"Gradio demo for Robust Video Matting. To use it, simply upload your video, or click one of the examples to load them. Read more at the links below."
|
33 |
+
)
|
34 |
+
with gr.Row():
|
35 |
+
inp = gr.Video(label="Input Video")
|
36 |
+
out = gr.Video(label="Output Video")
|
37 |
+
btn = gr.Button("Run")
|
38 |
+
btn.click(inference, inputs=inp, outputs=out)
|
39 |
+
|
40 |
+
gr.Examples(
|
41 |
+
examples=[["example.mp4"]],
|
42 |
+
inputs=[inp],
|
43 |
+
)
|
44 |
+
gr.HTML(
|
45 |
+
"<p style='text-align: center'><a href='https://arxiv.org/abs/2108.11515'>Robust High-Resolution Video Matting with Temporal Guidance</a> | <a href='https://github.com/PeterL1n/RobustVideoMatting'>Github Repo</a></p>"
|
46 |
+
)
|
47 |
|
48 |
+
block.queue(api_open=False, max_size=5).launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
@@ -4,4 +4,4 @@ torchaudio==2.1.0
|
|
4 |
torchvision==0.16.0
|
5 |
tqdm==4.61.1
|
6 |
pims
|
7 |
-
gradio
|
|
|
4 |
torchvision==0.16.0
|
5 |
tqdm==4.61.1
|
6 |
pims
|
7 |
+
gradio==3.16
|