Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +37 -0
- requirements.txt +9 -0
app.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import requests
|
3 |
+
|
4 |
+
NGROK_URL = "https://429e-35-192-148-148.ngrok-free.app" # Update this with your actual ngrok URL
|
5 |
+
|
6 |
+
def generate_and_save(prompt, negative_prompt, num_frames, guidance_scale, num_inference_steps, seed):
|
7 |
+
data = {
|
8 |
+
'prompt': prompt,
|
9 |
+
'negative_prompt': negative_prompt,
|
10 |
+
'num_frames': num_frames,
|
11 |
+
'guidance_scale': guidance_scale,
|
12 |
+
'num_inference_steps': num_inference_steps,
|
13 |
+
'seed': seed
|
14 |
+
}
|
15 |
+
response = requests.post(f'{NGROK_URL}/generate', json=data)
|
16 |
+
with open('output.gif', 'wb') as f:
|
17 |
+
f.write(response.content)
|
18 |
+
return 'output.gif'
|
19 |
+
|
20 |
+
interface = gr.Interface(
|
21 |
+
fn=generate_and_save,
|
22 |
+
inputs=[
|
23 |
+
gr.Textbox(label="Prompt"),
|
24 |
+
gr.Textbox(label="Negative Prompt"),
|
25 |
+
gr.Slider(minimum=8, maximum=32, step=1, label="Number of Frames", value=16),
|
26 |
+
gr.Slider(minimum=1, maximum=10, step=0.1, label="Guidance Scale", value=2.0),
|
27 |
+
gr.Slider(minimum=1, maximum=50, step=1, label="Inference Steps", value=6),
|
28 |
+
gr.Number(label="Seed", value=0),
|
29 |
+
],
|
30 |
+
outputs=gr.Image(type="filepath", label="Generated Animation"),
|
31 |
+
title="Text-to-Video Generation with AnimateLCM",
|
32 |
+
description="Generate short animations from text prompts using AnimateLCM model.",
|
33 |
+
)
|
34 |
+
|
35 |
+
if __name__ == "__main__":
|
36 |
+
interface.launch()
|
37 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
torch
|
2 |
+
diffusers
|
3 |
+
transformers
|
4 |
+
accelerate
|
5 |
+
safetensors
|
6 |
+
gradio
|
7 |
+
peft
|
8 |
+
flask
|
9 |
+
pyngrok
|