pranavajay
commited on
Update api.py
Browse files
api.py
CHANGED
@@ -79,15 +79,15 @@ def generate_random_sequence():
|
|
79 |
return f"{random_numbers}_{random_words}"
|
80 |
|
81 |
# Load the default pipeline once globally for efficiency
|
82 |
-
flux_pipe = FluxPipeline.from_pretrained("
|
83 |
flux_pipe.enable_model_cpu_offload()
|
84 |
logging.info("FluxPipeline loaded successfully.")
|
85 |
|
86 |
-
img_pipe = FluxImg2ImgPipeline.from_pretrained("
|
87 |
img_pipe.enable_model_cpu_offload()
|
88 |
logging.info("FluxImg2ImgPipeline loaded successfully.")
|
89 |
|
90 |
-
inpainting_pipe =
|
91 |
inpainting_pipe.enable_model_cpu_offload()
|
92 |
logging.info("FluxInpaintPipeline loaded successfully.")
|
93 |
|
@@ -157,7 +157,7 @@ async def set_controlnet_adapter(adapter: str, is_inpainting: bool = False):
|
|
157 |
controlnet = FluxControlNetModel.from_pretrained(controlnet_model_path, torch_dtype=torch.bfloat16)
|
158 |
pipeline_cls = FluxControlNetPipeline if not is_inpainting else FluxControlNetInpaintPipeline
|
159 |
flux_controlnet_pipe = pipeline_cls.from_pretrained(
|
160 |
-
"
|
161 |
)
|
162 |
flux_controlnet_pipe.to("cuda")
|
163 |
logging.info(f"ControlNet adapter '{adapter}' loaded successfully.")
|
|
|
79 |
return f"{random_numbers}_{random_words}"
|
80 |
|
81 |
# Load the default pipeline once globally for efficiency
|
82 |
+
flux_pipe = FluxPipeline.from_pretrained("pranavajay/flow", torch_dtype=torch.bfloat16)
|
83 |
flux_pipe.enable_model_cpu_offload()
|
84 |
logging.info("FluxPipeline loaded successfully.")
|
85 |
|
86 |
+
img_pipe = FluxImg2ImgPipeline.from_pretrained("pranavajay/flow", torch_dtype=torch.bfloat16)
|
87 |
img_pipe.enable_model_cpu_offload()
|
88 |
logging.info("FluxImg2ImgPipeline loaded successfully.")
|
89 |
|
90 |
+
inpainting_pipe = FluxImg2ImgPipeline.from_pretrained("pranavajay/flow", torch_dtype=torch.bfloat16)
|
91 |
inpainting_pipe.enable_model_cpu_offload()
|
92 |
logging.info("FluxInpaintPipeline loaded successfully.")
|
93 |
|
|
|
157 |
controlnet = FluxControlNetModel.from_pretrained(controlnet_model_path, torch_dtype=torch.bfloat16)
|
158 |
pipeline_cls = FluxControlNetPipeline if not is_inpainting else FluxControlNetInpaintPipeline
|
159 |
flux_controlnet_pipe = pipeline_cls.from_pretrained(
|
160 |
+
"pranavajay/flow", controlnet=controlnet, torch_dtype=torch.bfloat16
|
161 |
)
|
162 |
flux_controlnet_pipe.to("cuda")
|
163 |
logging.info(f"ControlNet adapter '{adapter}' loaded successfully.")
|