valhalla commited on
Commit
59db96e
1 Parent(s): ebd0807

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -19
app.py CHANGED
@@ -91,6 +91,7 @@ def run(
91
  image: PIL.Image.Image,
92
  prompt: str,
93
  negative_prompt: str,
 
94
  num_steps=25,
95
  guidance_scale=5,
96
  adapter_conditioning_scale=0.8,
@@ -100,6 +101,8 @@ def run(
100
  image = TF.to_tensor(image) > 0.5
101
  image = TF.to_pil_image(image.to(torch.float32))
102
 
 
 
103
  generator = torch.Generator(device=device).manual_seed(seed)
104
  out = pipe(
105
  prompt=prompt,
@@ -175,6 +178,7 @@ with gr.Blocks() as demo:
175
  image,
176
  prompt,
177
  negative_prompt,
 
178
  num_steps,
179
  guidance_scale,
180
  adapter_conditioning_scale,
@@ -192,25 +196,6 @@ with gr.Blocks() as demo:
192
  outputs=result,
193
  api_name=False,
194
  )
195
- prompt.submit(
196
- fn=apply_style,
197
- inputs=[style, prompt, negative_prompt],
198
- outputs=[prompt, negative_prompt],
199
- queue=False,
200
- api_name=False,
201
- ).then(
202
- fn=run,
203
- inputs=inputs,
204
- outputs=result,
205
- api_name=False,
206
- )
207
- style.change(
208
- fn=apply_style,
209
- inputs=[style, prompt, negative_prompt],
210
- outputs=[prompt, negative_prompt],
211
- queue=False,
212
- api_name=False,
213
- )
214
  run_button.click(
215
  fn=randomize_seed_fn,
216
  inputs=[seed, randomize_seed],
 
91
  image: PIL.Image.Image,
92
  prompt: str,
93
  negative_prompt: str,
94
+ style=default_style,
95
  num_steps=25,
96
  guidance_scale=5,
97
  adapter_conditioning_scale=0.8,
 
101
  image = TF.to_tensor(image) > 0.5
102
  image = TF.to_pil_image(image.to(torch.float32))
103
 
104
+ prompt, negative_prompt = apply_style(style, prompt, negative_prompt)
105
+
106
  generator = torch.Generator(device=device).manual_seed(seed)
107
  out = pipe(
108
  prompt=prompt,
 
178
  image,
179
  prompt,
180
  negative_prompt,
181
+ style,
182
  num_steps,
183
  guidance_scale,
184
  adapter_conditioning_scale,
 
196
  outputs=result,
197
  api_name=False,
198
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  run_button.click(
200
  fn=randomize_seed_fn,
201
  inputs=[seed, randomize_seed],