theSure commited on
Commit
c242d06
·
verified ·
1 Parent(s): 64287ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -49,12 +49,10 @@ image_examples = [
49
  ]
50
 
51
  ]
52
- class PipelineContainer:
53
- pipe = None
54
  @spaces.GPU(duration=120)
55
  def load_model(base_model_path, lora_path):
56
- global pipe
57
- PipelineContainer.pipe = pipe
58
  transformer = FluxTransformer2DModel.from_pretrained(base_model_path, subfolder='transformer', torch_dtype=torch.bfloat16)
59
  gr.Info(str(f"Model loading: {int((40 / 100) * 100)}%"))
60
  # enable image inputs
@@ -105,7 +103,6 @@ def predict(
105
  mask_paths
106
 
107
  ):
108
- pipe = PipelineContainer.pipe
109
  global image_path, mask_path
110
  gr.Info(str(f"Set seed = {seed}"))
111
  if image_paths is not None:
@@ -150,6 +147,7 @@ def predict(
150
  gray_image_pil = Image.fromarray(gray_image).convert('L')
151
  else:
152
  gray_image_pil = input_image["layers"][0]
 
153
  result = pipe(
154
  prompt=prompt,
155
  control_image=input_image["background"].convert("RGB"),
 
49
  ]
50
 
51
  ]
52
+
 
53
  @spaces.GPU(duration=120)
54
  def load_model(base_model_path, lora_path):
55
+ global pipe
 
56
  transformer = FluxTransformer2DModel.from_pretrained(base_model_path, subfolder='transformer', torch_dtype=torch.bfloat16)
57
  gr.Info(str(f"Model loading: {int((40 / 100) * 100)}%"))
58
  # enable image inputs
 
103
  mask_paths
104
 
105
  ):
 
106
  global image_path, mask_path
107
  gr.Info(str(f"Set seed = {seed}"))
108
  if image_paths is not None:
 
147
  gray_image_pil = Image.fromarray(gray_image).convert('L')
148
  else:
149
  gray_image_pil = input_image["layers"][0]
150
+ load_model(base_model_path=base_model_path, lora_path=lora_path)
151
  result = pipe(
152
  prompt=prompt,
153
  control_image=input_image["background"].convert("RGB"),