testsson / app.py
cakemus's picture
kandinskytest
5dc1a58
raw
history blame
879 Bytes
import gradio as gr
from transformers import pipeline
from spaces import GPU # Import the GPU decorator for ZeroGPU
from PIL import Image
# Use @GPU to allocate a GPU when running the video generation function
@GPU
def generate_video(prompt):
# Load the Kandinsky video model
video_model = pipeline("video-generation", model="ai-forever/KandinskyVideo_1_1", device=0)
# Generate video based on the prompt
video = video_model(prompt)
return video # Ensure this returns the video file or frames
# Create the Gradio interface
interface = gr.Interface(
fn=generate_video,
inputs=gr.Textbox(label="Enter your prompt here"),
outputs="video",
title="AI Video Generator",
description="This app generates a short video based on your input prompt using KandinskyVideo_1_1.",
theme="dark"
)
if __name__ == "__main__":
interface.launch()