Spaces:
Running
on
Zero
Running
on
Zero
updates
Browse files- flux_app/backend.py +2 -3
flux_app/backend.py
CHANGED
|
@@ -30,7 +30,6 @@ class ModelManager:
|
|
| 30 |
|
| 31 |
self.initialize_models()
|
| 32 |
|
| 33 |
-
@spaces.GPU(duration=100)
|
| 34 |
def initialize_models(self):
|
| 35 |
"""Initializes the diffusion pipelines and autoencoders."""
|
| 36 |
self.taef1 = AutoencoderTiny.from_pretrained(TAEF1_MODEL, torch_dtype=DTYPE).to(DEVICE)
|
|
@@ -48,9 +47,10 @@ class ModelManager:
|
|
| 48 |
).to(DEVICE)
|
| 49 |
|
| 50 |
setattr(self.pipe, "flux_pipe_call_that_returns_an_iterable_of_images", self.process_images)
|
| 51 |
-
|
| 52 |
def process_images(self, *args, **kwargs):
|
| 53 |
return flux_pipe_call_that_returns_an_iterable_of_images(self.pipe, *args, **kwargs)
|
|
|
|
| 54 |
@spaces.GPU(duration=100)
|
| 55 |
def generate_image(self, prompt_mash, steps, seed, cfg_scale, width, height, lora_scale):
|
| 56 |
"""Generates an image using the FLUX pipeline."""
|
|
@@ -70,7 +70,6 @@ class ModelManager:
|
|
| 70 |
good_vae=self.good_vae,
|
| 71 |
):
|
| 72 |
yield img
|
| 73 |
-
#@spaces.GPU(duration=100)
|
| 74 |
def generate_image_to_image(self, prompt_mash, image_input_path, image_strength, steps, cfg_scale, width, height, lora_scale, seed):
|
| 75 |
"""Generates an image using image-to-image processing."""
|
| 76 |
generator = torch.Generator(device=DEVICE).manual_seed(seed)
|
|
|
|
| 30 |
|
| 31 |
self.initialize_models()
|
| 32 |
|
|
|
|
| 33 |
def initialize_models(self):
|
| 34 |
"""Initializes the diffusion pipelines and autoencoders."""
|
| 35 |
self.taef1 = AutoencoderTiny.from_pretrained(TAEF1_MODEL, torch_dtype=DTYPE).to(DEVICE)
|
|
|
|
| 47 |
).to(DEVICE)
|
| 48 |
|
| 49 |
setattr(self.pipe, "flux_pipe_call_that_returns_an_iterable_of_images", self.process_images)
|
| 50 |
+
|
| 51 |
def process_images(self, *args, **kwargs):
|
| 52 |
return flux_pipe_call_that_returns_an_iterable_of_images(self.pipe, *args, **kwargs)
|
| 53 |
+
|
| 54 |
@spaces.GPU(duration=100)
|
| 55 |
def generate_image(self, prompt_mash, steps, seed, cfg_scale, width, height, lora_scale):
|
| 56 |
"""Generates an image using the FLUX pipeline."""
|
|
|
|
| 70 |
good_vae=self.good_vae,
|
| 71 |
):
|
| 72 |
yield img
|
|
|
|
| 73 |
def generate_image_to_image(self, prompt_mash, image_input_path, image_strength, steps, cfg_scale, width, height, lora_scale, seed):
|
| 74 |
"""Generates an image using image-to-image processing."""
|
| 75 |
generator = torch.Generator(device=DEVICE).manual_seed(seed)
|