Update handler.py
Browse files- handler.py +7 -8
handler.py
CHANGED
|
@@ -15,16 +15,16 @@ class EndpointHandler:
|
|
| 15 |
torch_dtype=torch.float16,
|
| 16 |
)
|
| 17 |
|
| 18 |
-
#
|
| 19 |
print("🔍 Available methods on pipeline:", dir(self.pipe))
|
| 20 |
|
| 21 |
-
# Load your
|
| 22 |
try:
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
print(
|
| 28 |
except Exception as e:
|
| 29 |
print(f"⚠️ Failed to load LoRA weights: {str(e)}")
|
| 30 |
|
|
@@ -38,7 +38,6 @@ class EndpointHandler:
|
|
| 38 |
|
| 39 |
# Defensive parsing
|
| 40 |
if isinstance(data, dict):
|
| 41 |
-
# Direct prompt/image dict
|
| 42 |
prompt = data.get("prompt")
|
| 43 |
image_input = data.get("image")
|
| 44 |
|
|
|
|
| 15 |
torch_dtype=torch.float16,
|
| 16 |
)
|
| 17 |
|
| 18 |
+
# Debug available methods on pipeline
|
| 19 |
print("🔍 Available methods on pipeline:", dir(self.pipe))
|
| 20 |
|
| 21 |
+
# Load your LoRA weights from your Hugging Face repo
|
| 22 |
try:
|
| 23 |
+
self.pipe.load_lora_weights(
|
| 24 |
+
"Texttra/BhoriKontext",
|
| 25 |
+
weight_name="Bh0r1.safetensors"
|
| 26 |
+
)
|
| 27 |
+
print("✅ LoRA weights loaded from Texttra/BhoriKontext/Bh0r1.safetensors.")
|
| 28 |
except Exception as e:
|
| 29 |
print(f"⚠️ Failed to load LoRA weights: {str(e)}")
|
| 30 |
|
|
|
|
| 38 |
|
| 39 |
# Defensive parsing
|
| 40 |
if isinstance(data, dict):
|
|
|
|
| 41 |
prompt = data.get("prompt")
|
| 42 |
image_input = data.get("image")
|
| 43 |
|