Update handler.py
Browse files- handler.py +7 -1
handler.py
CHANGED
@@ -6,7 +6,7 @@ from PIL import Image
|
|
6 |
import io
|
7 |
|
8 |
class CustomHandler:
|
9 |
-
def __init__(self, model_dir="
|
10 |
# Load model and pipeline
|
11 |
self.controlnet = FluxControlNetModel.from_pretrained(
|
12 |
model_dir, torch_dtype=torch.bfloat16
|
@@ -50,3 +50,9 @@ class CustomHandler:
|
|
50 |
).images[0]
|
51 |
# Postprocess output
|
52 |
return self.postprocess(output_image)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
import io
|
7 |
|
8 |
class CustomHandler:
|
9 |
+
def __init__(self, model_dir="jasperai/Flux.1-dev-Controlnet-Upscaler"):
|
10 |
# Load model and pipeline
|
11 |
self.controlnet = FluxControlNetModel.from_pretrained(
|
12 |
model_dir, torch_dtype=torch.bfloat16
|
|
|
50 |
).images[0]
|
51 |
# Postprocess output
|
52 |
return self.postprocess(output_image)
|
53 |
+
|
54 |
+
|
55 |
+
# Đảm bảo rằng bạn có thể sử dụng EndpointHandler từ module handler.
|
56 |
+
class EndpointHandler(CustomHandler):
|
57 |
+
def __init__(self, model_dir="jasperai/Flux.1-dev-Controlnet-Upscaler"):
|
58 |
+
super().__init__(model_dir)
|