File size: 959 Bytes
ac81f3a
 
 
96018f7
 
 
ac81f3a
 
96018f7
ac81f3a
 
 
 
96018f7
ac81f3a
96018f7
ac81f3a
 
 
96018f7
ac81f3a
96018f7
ac81f3a
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import gradio as gr
from generate import generate

def infer(prompt, steps, guidance, frames):
    gif_path = generate(prompt, num_frames=frames, steps=steps, guidance=guidance)
    return gif_path

with gr.Blocks() as demo:
    gr.Markdown("# πŸŒ€ AnimateDiff Generator\nEnter a text prompt and get an animated GIF.")

    with gr.Row():
        with gr.Column():
            prompt = gr.Textbox(label="Prompt", placeholder="Describe your animation...")
            steps = gr.Slider(10, 100, value=25, step=1, label="Inference Steps")
            guidance = gr.Slider(1, 15, value=7.5, step=0.5, label="Guidance Scale")
            frames = gr.Slider(8, 32, value=16, step=1, label="Number of Frames")
            btn = gr.Button("Generate")

        with gr.Column():
            output = gr.Video(label="Generated Animation")

    btn.click(fn=infer, inputs=[prompt, steps, guidance, frames], outputs=output)

if __name__ == "__main__":
    demo.launch()