slymnyldrm commited on
Commit
d484d65
1 Parent(s): 20c8d29

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -12,6 +12,7 @@ pipe = StableDiffusionPipeline.from_pretrained(model_path, use_safetensors=True,
12
  pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
13
 
14
  g_cuda = torch.Generator()
 
15
 
16
  def inference(prompt, negative_prompt, num_samples, height=512, width=512, num_inference_steps=50, guidance_scale=7.5, g_seed=52362):
17
  with torch.inference_mode():
@@ -20,7 +21,7 @@ def inference(prompt, negative_prompt, num_samples, height=512, width=512, num_i
20
  negative_prompt=negative_prompt,
21
  num_images_per_prompt=int(num_samples),
22
  num_inference_steps=int(num_inference_steps), guidance_scale=guidance_scale,
23
- generator=g_cuda.manual_seed(g_seed)
24
  ).images
25
 
26
  with gr.Blocks() as demo:
@@ -35,7 +36,7 @@ with gr.Blocks() as demo:
35
  with gr.Row():
36
  height = gr.Number(label="Height", value=512)
37
  width = gr.Number(label="Width", value=512)
38
- num_inference_steps = gr.Slider(label="Steps", value=50)
39
  with gr.Column():
40
  gallery = gr.Gallery()
41
 
 
12
  pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
13
 
14
  g_cuda = torch.Generator()
15
+ g_cuda.manual_seed(g_seed)
16
 
17
  def inference(prompt, negative_prompt, num_samples, height=512, width=512, num_inference_steps=50, guidance_scale=7.5, g_seed=52362):
18
  with torch.inference_mode():
 
21
  negative_prompt=negative_prompt,
22
  num_images_per_prompt=int(num_samples),
23
  num_inference_steps=int(num_inference_steps), guidance_scale=guidance_scale,
24
+ generator=g_cuda
25
  ).images
26
 
27
  with gr.Blocks() as demo:
 
36
  with gr.Row():
37
  height = gr.Number(label="Height", value=512)
38
  width = gr.Number(label="Width", value=512)
39
+ num_inference_steps = gr.Slider(label="Steps", value=25)
40
  with gr.Column():
41
  gallery = gr.Gallery()
42