Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import gradio as gr
|
|
6 |
|
7 |
|
8 |
def tune_video_predict(
|
|
|
9 |
prompt: str,
|
10 |
video_length: int,
|
11 |
height: int,
|
@@ -13,7 +14,7 @@ def tune_video_predict(
|
|
13 |
num_inference_steps: int,
|
14 |
guidance_scale: float,
|
15 |
):
|
16 |
-
unet = UNet3DConditionModel.from_pretrained(
|
17 |
pipe = TuneAVideoPipeline.from_pretrained('CompVis/stable-diffusion-v1-4', unet=unet, torch_dtype=torch.float16).to("cuda")
|
18 |
video = pipe(prompt, video_length=video_length, height=height, width=width, num_inference_steps=num_inference_steps, guidance_scale=guidance_scale).videos
|
19 |
output_path = save_videos_grid(video, save_path='output', path=f"{prompt}.gif")
|
@@ -21,6 +22,13 @@ def tune_video_predict(
|
|
21 |
|
22 |
|
23 |
demo_inputs = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
gr.inputs.Textbox(
|
25 |
label="Prompt",
|
26 |
default='a flower blooming'
|
@@ -67,8 +75,10 @@ demo_inputs = [
|
|
67 |
demo_outputs = gr.outputs.Video(type="gif", label="Output")
|
68 |
|
69 |
examples = [
|
70 |
-
["a panda is surfing",
|
71 |
-
["a flower blooming", 5, 416, 416, 50, 7.5],
|
|
|
|
|
72 |
]
|
73 |
|
74 |
description = "This generates video from an input text, using [one-shot tuning of diffusion models](https://arxiv.org/abs/2212.11565). To use it, simply input a text."
|
|
|
6 |
|
7 |
|
8 |
def tune_video_predict(
|
9 |
+
pipe_id: str,
|
10 |
prompt: str,
|
11 |
video_length: int,
|
12 |
height: int,
|
|
|
14 |
num_inference_steps: int,
|
15 |
guidance_scale: float,
|
16 |
):
|
17 |
+
unet = UNet3DConditionModel.from_pretrained(pipe_id, subfolder='unet', torch_dtype=torch.float16).to('cuda')
|
18 |
pipe = TuneAVideoPipeline.from_pretrained('CompVis/stable-diffusion-v1-4', unet=unet, torch_dtype=torch.float16).to("cuda")
|
19 |
video = pipe(prompt, video_length=video_length, height=height, width=width, num_inference_steps=num_inference_steps, guidance_scale=guidance_scale).videos
|
20 |
output_path = save_videos_grid(video, save_path='output', path=f"{prompt}.gif")
|
|
|
22 |
|
23 |
|
24 |
demo_inputs = [
|
25 |
+
gr.inputs.Dropdown(
|
26 |
+
label="Model",
|
27 |
+
choices=[
|
28 |
+
"Tune-A-Video-library/a-man-is-surfing",
|
29 |
+
"sd-dreambooth-library/mr-potato-head",
|
30 |
+
]
|
31 |
+
),
|
32 |
gr.inputs.Textbox(
|
33 |
label="Prompt",
|
34 |
default='a flower blooming'
|
|
|
75 |
demo_outputs = gr.outputs.Video(type="gif", label="Output")
|
76 |
|
77 |
examples = [
|
78 |
+
["Tune-A-Video-library/a-man-is-surfing", "a panda is surfing", 5, 416, 416, 50, 7.5],
|
79 |
+
["Tune-A-Video-library/a-man-is-surfing", "a flower blooming", 5, 416, 416, 50, 7.5],
|
80 |
+
["sd-dreambooth-library/mr-potato-head", "sks mr potato head, wearing a pink hat, is surfing.", 5, 416, 416, 50, 7.5],
|
81 |
+
["sd-dreambooth-library/mr-potato-head", "sks mr potato head is surfing in the forest.", 5, 416, 416, 50, 7.5],
|
82 |
]
|
83 |
|
84 |
description = "This generates video from an input text, using [one-shot tuning of diffusion models](https://arxiv.org/abs/2212.11565). To use it, simply input a text."
|