Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import requests
|
3 |
-
|
4 |
-
NGROK_URL = "https://
|
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 |
-
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import requests
|
3 |
+
|
4 |
+
NGROK_URL = "https://f719-34-74-140-255.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 |
+
|