handle
#24
by
ismailhakki37
- opened
- handler.py +9 -2
handler.py
CHANGED
|
@@ -542,8 +542,15 @@ class EndpointHandler:
|
|
| 542 |
print(f"EndpointHandler initialized with model_dir: {model_dir}")
|
| 543 |
|
| 544 |
def __call__(self, payload):
|
| 545 |
-
"""Main endpoint function -
|
| 546 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 547 |
|
| 548 |
def health_check(self):
|
| 549 |
"""Health check endpoint"""
|
|
|
|
| 542 |
print(f"EndpointHandler initialized with model_dir: {model_dir}")
|
| 543 |
|
| 544 |
def __call__(self, payload):
|
| 545 |
+
"""Main endpoint function - handles Hugging Face payload format"""
|
| 546 |
+
# Hugging Face sends payload in "inputs" wrapper
|
| 547 |
+
if "inputs" in payload:
|
| 548 |
+
# Extract the actual payload from inputs wrapper
|
| 549 |
+
actual_payload = payload["inputs"]
|
| 550 |
+
return query(actual_payload)
|
| 551 |
+
else:
|
| 552 |
+
# Direct payload (for backward compatibility)
|
| 553 |
+
return query(payload)
|
| 554 |
|
| 555 |
def health_check(self):
|
| 556 |
"""Health check endpoint"""
|