fffiloni commited on
Commit
54c5b48
·
1 Parent(s): 556c87e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -60,7 +60,7 @@ def load_model(custom_model):
60
  return gr.update(choices=sfts_available_files, value=sfts_available_files[0], visible=True), gr.update(value=instance_prompt, visible=True)
61
 
62
 
63
-
64
  def infer (custom_model, weight_name, prompt, inf_steps, guidance_scale, seed, lora_weight, progress=gr.Progress(track_tqdm=True)):
65
 
66
  vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
@@ -105,7 +105,7 @@ def infer (custom_model, weight_name, prompt, inf_steps, guidance_scale, seed, l
105
 
106
  #pipe.unfuse_lora()
107
 
108
- return image
109
 
110
  css="""
111
  #col-container{
@@ -205,6 +205,8 @@ with gr.Blocks(css=css) as demo:
205
  step=0.1,
206
  value=7.5
207
  )
 
 
208
  seed = gr.Slider(
209
  label="Seed",
210
  info = "-1 denotes a random seed",
@@ -213,6 +215,10 @@ with gr.Blocks(css=css) as demo:
213
  step=1,
214
  value=-1
215
  )
 
 
 
 
216
  lora_weight = gr.Slider(
217
  label="LoRa weigth",
218
  minimum=0.0,
@@ -232,7 +238,7 @@ with gr.Blocks(css=css) as demo:
232
  submit_btn.click(
233
  fn = infer,
234
  inputs = [custom_model, weight_name, prompt_in, inf_steps, guidance_scale, seed, lora_weight],
235
- outputs = [image_out]
236
  )
237
 
238
  demo.queue().launch()
 
60
  return gr.update(choices=sfts_available_files, value=sfts_available_files[0], visible=True), gr.update(value=instance_prompt, visible=True)
61
 
62
 
63
+ @spaces.GPU
64
  def infer (custom_model, weight_name, prompt, inf_steps, guidance_scale, seed, lora_weight, progress=gr.Progress(track_tqdm=True)):
65
 
66
  vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
 
105
 
106
  #pipe.unfuse_lora()
107
 
108
+ return image, seed
109
 
110
  css="""
111
  #col-container{
 
205
  step=0.1,
206
  value=7.5
207
  )
208
+
209
+ with gr.Row():
210
  seed = gr.Slider(
211
  label="Seed",
212
  info = "-1 denotes a random seed",
 
215
  step=1,
216
  value=-1
217
  )
218
+ last_used_seed = gr.Number(
219
+ label = "Last used seed",
220
+ info = "the seed used in the last generation",
221
+ )
222
  lora_weight = gr.Slider(
223
  label="LoRa weigth",
224
  minimum=0.0,
 
238
  submit_btn.click(
239
  fn = infer,
240
  inputs = [custom_model, weight_name, prompt_in, inf_steps, guidance_scale, seed, lora_weight],
241
+ outputs = [image_out, last_used_seed]
242
  )
243
 
244
  demo.queue().launch()