Prgckwb commited on
Commit
31e829c
1 Parent(s): 9ef80c7

:tada: change

Browse files
Files changed (1) hide show
  1. app.py +6 -13
app.py CHANGED
@@ -28,16 +28,13 @@ if device == 'cuda':
28
  ).to(device)
29
 
30
 
 
31
  @spaces.GPU()
32
  @torch.inference_mode()
33
  def inference(
34
  model_id: str,
35
  prompt: str,
36
  negative_prompt: str = "",
37
- width: int = 512,
38
- height: int = 512,
39
- guidance_scale: float = 7.5,
40
- num_inference_steps: int | None = None,
41
  progress=gr.Progress(track_tqdm=True),
42
  ) -> Image.Image:
43
  global current_model_id, pipe
@@ -55,10 +52,6 @@ def inference(
55
  image = pipe(
56
  prompt,
57
  negative_prompt=negative_prompt,
58
- width=width,
59
- height=height,
60
- guidance_scale=guidance_scale,
61
- num_inference_steps=num_inference_steps,
62
  ).images[0]
63
 
64
  return image
@@ -82,12 +75,12 @@ if __name__ == "__main__":
82
 
83
  with gr.Accordion("Additional Settings (W.I.P)", open=False):
84
  with gr.Row():
85
- width = gr.Number(label="Width", value=512, step=64, minimum=64, maximum=1024)
86
- height = gr.Number(label="Height", value=512, step=64, minimum=64, maximum=1024)
87
 
88
  additional_inputs = [
89
- width,
90
- height,
91
  gr.Number(label="Guidance Scale", value=7.5, step=0.5, minimum=0, maximum=10),
92
  gr.Slider(label="Num Inference Steps", value=None, minimum=1, maximum=1000, step=1)
93
  ]
@@ -105,6 +98,6 @@ if __name__ == "__main__":
105
  )
106
 
107
  btn = gr.Button("Generate")
108
- btn.click(fn=inference, inputs=inputs + additional_inputs, outputs=outputs)
109
 
110
  demo.queue().launch()
 
28
  ).to(device)
29
 
30
 
31
+
32
  @spaces.GPU()
33
  @torch.inference_mode()
34
  def inference(
35
  model_id: str,
36
  prompt: str,
37
  negative_prompt: str = "",
 
 
 
 
38
  progress=gr.Progress(track_tqdm=True),
39
  ) -> Image.Image:
40
  global current_model_id, pipe
 
52
  image = pipe(
53
  prompt,
54
  negative_prompt=negative_prompt,
 
 
 
 
55
  ).images[0]
56
 
57
  return image
 
75
 
76
  with gr.Accordion("Additional Settings (W.I.P)", open=False):
77
  with gr.Row():
78
+ width_component = gr.Number(label="Width", value=512, step=64, minimum=64, maximum=1024)
79
+ height_component = gr.Number(label="Height", value=512, step=64, minimum=64, maximum=1024)
80
 
81
  additional_inputs = [
82
+ width_component,
83
+ height_component,
84
  gr.Number(label="Guidance Scale", value=7.5, step=0.5, minimum=0, maximum=10),
85
  gr.Slider(label="Num Inference Steps", value=None, minimum=1, maximum=1000, step=1)
86
  ]
 
98
  )
99
 
100
  btn = gr.Button("Generate")
101
+ btn.click(fn=inference, inputs=inputs, outputs=outputs)
102
 
103
  demo.queue().launch()