Akshat7777 commited on
Commit
96018f7
Β·
verified Β·
1 Parent(s): 730aa68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -1,25 +1,25 @@
1
  import gradio as gr
2
  from generate import generate
3
 
4
- def infer(prompt, steps, guidance):
5
- output = generate(prompt, steps, guidance)
6
- return output
7
 
8
  with gr.Blocks() as demo:
9
- gr.Markdown("# πŸŒ€ AnimateDiff Generator")
10
 
11
  with gr.Row():
12
  with gr.Column():
13
  prompt = gr.Textbox(label="Prompt", placeholder="Describe your animation...")
14
- steps = gr.Slider(10, 100, value=50, step=1, label="Inference Steps")
15
  guidance = gr.Slider(1, 15, value=7.5, step=0.5, label="Guidance Scale")
 
16
  btn = gr.Button("Generate")
17
 
18
  with gr.Column():
19
- output = gr.Image(label="Generated Frame")
20
 
21
- btn.click(fn=infer, inputs=[prompt, steps, guidance], outputs=output)
22
 
23
  if __name__ == "__main__":
24
  demo.launch()
25
-
 
1
  import gradio as gr
2
  from generate import generate
3
 
4
+ def infer(prompt, steps, guidance, frames):
5
+ gif_path = generate(prompt, num_frames=frames, steps=steps, guidance=guidance)
6
+ return gif_path
7
 
8
  with gr.Blocks() as demo:
9
+ gr.Markdown("# πŸŒ€ AnimateDiff Generator\nEnter a text prompt and get an animated GIF.")
10
 
11
  with gr.Row():
12
  with gr.Column():
13
  prompt = gr.Textbox(label="Prompt", placeholder="Describe your animation...")
14
+ steps = gr.Slider(10, 100, value=25, step=1, label="Inference Steps")
15
  guidance = gr.Slider(1, 15, value=7.5, step=0.5, label="Guidance Scale")
16
+ frames = gr.Slider(8, 32, value=16, step=1, label="Number of Frames")
17
  btn = gr.Button("Generate")
18
 
19
  with gr.Column():
20
+ output = gr.Video(label="Generated Animation")
21
 
22
+ btn.click(fn=infer, inputs=[prompt, steps, guidance, frames], outputs=output)
23
 
24
  if __name__ == "__main__":
25
  demo.launch()