hanzla commited on
Commit
c19b47e
·
1 Parent(s): 0722150

sliders added

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -19,19 +19,15 @@ scheduler = DDIMScheduler.from_pretrained(
19
  steps_offset=1,
20
  )
21
  pipe.scheduler = scheduler
22
-
23
- # enable memory savings
24
- pipe.enable_vae_slicing()
25
- pipe.enable_model_cpu_offload()
26
  @spaces.GPU
27
- def generate(prompt):
28
  pipe.to(device)
29
  output = pipe(
30
  prompt=prompt,
31
  negative_prompt="bad quality, worse quality",
32
  num_frames=16,
33
- guidance_scale=7.5,
34
- num_inference_steps=4,
35
  )
36
 
37
  name = str(uuid.uuid4()).replace("-", "")
@@ -40,8 +36,12 @@ def generate(prompt):
40
  return path
41
 
42
  iface = gr.Interface(
43
- fn=generate,
44
- inputs=gr.Textbox(label="Enter your prompt"),
 
 
 
 
45
  outputs=gr.Video(label="Generated Video"),
46
  )
47
 
 
19
  steps_offset=1,
20
  )
21
  pipe.scheduler = scheduler
 
 
 
 
22
  @spaces.GPU
23
+ def generate_video(prompt, guidance_scale, num_inference_steps):
24
  pipe.to(device)
25
  output = pipe(
26
  prompt=prompt,
27
  negative_prompt="bad quality, worse quality",
28
  num_frames=16,
29
+ guidance_scale=guidance_scale,
30
+ num_inference_steps=num_inference_steps,
31
  )
32
 
33
  name = str(uuid.uuid4()).replace("-", "")
 
36
  return path
37
 
38
  iface = gr.Interface(
39
+ fn=generate_video,
40
+ inputs=[
41
+ gr.Textbox(label="Enter your prompt"),
42
+ gr.Slider(minimum=0.5, maximum=10, value=7.5, label="Guidance Scale"),
43
+ gr.Slider(minimum=4, maximum=24, step=4, value=4, label="Inference Steps"),
44
+ ],
45
  outputs=gr.Video(label="Generated Video"),
46
  )
47