kandinskytest
Browse files- app.py +12 -12
- requirements.txt +3 -1
app.py
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
from spaces import GPU # Import the GPU decorator for ZeroGPU
|
|
|
4 |
|
5 |
-
#
|
6 |
@GPU
|
7 |
-
def
|
8 |
-
# Load the
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
15 |
# Create the Gradio interface
|
16 |
interface = gr.Interface(
|
17 |
-
fn=
|
18 |
inputs=gr.Textbox(label="Enter your prompt here"),
|
19 |
-
outputs=
|
20 |
-
title="AI
|
21 |
-
description="This app generates
|
22 |
theme="dark"
|
23 |
)
|
24 |
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
from spaces import GPU # Import the GPU decorator for ZeroGPU
|
4 |
+
from PIL import Image
|
5 |
|
6 |
+
# Use @GPU to allocate a GPU when running the video generation function
|
7 |
@GPU
|
8 |
+
def generate_video(prompt):
|
9 |
+
# Load the Kandinsky video model
|
10 |
+
video_model = pipeline("video-generation", model="ai-forever/KandinskyVideo_1_1", device=0)
|
11 |
+
# Generate video based on the prompt
|
12 |
+
video = video_model(prompt)
|
13 |
+
return video # Ensure this returns the video file or frames
|
|
|
14 |
|
15 |
# Create the Gradio interface
|
16 |
interface = gr.Interface(
|
17 |
+
fn=generate_video,
|
18 |
inputs=gr.Textbox(label="Enter your prompt here"),
|
19 |
+
outputs="video",
|
20 |
+
title="AI Video Generator",
|
21 |
+
description="This app generates a short video based on your input prompt using KandinskyVideo_1_1.",
|
22 |
theme="dark"
|
23 |
)
|
24 |
|
requirements.txt
CHANGED
@@ -1,2 +1,4 @@
|
|
1 |
gradio
|
2 |
-
transformers
|
|
|
|
|
|
1 |
gradio
|
2 |
+
transformers
|
3 |
+
torch
|
4 |
+
Pillow
|