Artiprocher commited on
Commit
be940e8
1 Parent(s): e05c12f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -130,12 +130,6 @@ def load_model(model_type, model_path):
130
  return model_manager, pipe
131
 
132
 
133
- @spaces.GPU(duration=60)
134
- def infer(pipe, input_params, seed):
135
- torch.manual_seed(seed)
136
- return pipe(**input_params)
137
-
138
-
139
  model_dict = {}
140
  load_model("FLUX", "FLUX.1-dev")
141
  load_model("Kolors", "Kolors")
@@ -219,6 +213,7 @@ with gr.Blocks() as app:
219
  outputs=[output_image],
220
  triggers=run_button.click
221
  )
 
222
  def generate_image(model_type, model_path, prompt, negative_prompt, cfg_scale, embedded_guidance, num_inference_steps, height, width, seed, *args, progress=gr.Progress()):
223
  _, pipe = load_model(model_type, model_path)
224
  input_params = {
@@ -251,7 +246,8 @@ with gr.Blocks() as app:
251
  "masks": masks,
252
  "mask_scales": mask_scales,
253
  })
254
- image = infer(pipe, input_params, seed)
 
255
  return image
256
 
257
  @gr.on(inputs=[output_image] + canvas_list, outputs=canvas_list, triggers=output_to_painter_button.click)
 
130
  return model_manager, pipe
131
 
132
 
 
 
 
 
 
 
133
  model_dict = {}
134
  load_model("FLUX", "FLUX.1-dev")
135
  load_model("Kolors", "Kolors")
 
213
  outputs=[output_image],
214
  triggers=run_button.click
215
  )
216
+ @spaces.GPU(duration=60)
217
  def generate_image(model_type, model_path, prompt, negative_prompt, cfg_scale, embedded_guidance, num_inference_steps, height, width, seed, *args, progress=gr.Progress()):
218
  _, pipe = load_model(model_type, model_path)
219
  input_params = {
 
246
  "masks": masks,
247
  "mask_scales": mask_scales,
248
  })
249
+ torch.manual_seed(seed)
250
+ image = pipe(**input_params)
251
  return image
252
 
253
  @gr.on(inputs=[output_image] + canvas_list, outputs=canvas_list, triggers=output_to_painter_button.click)