remove req
Browse files- handler.py +6 -3
- test_inference_endpoint.py +1 -1
handler.py
CHANGED
|
@@ -24,9 +24,12 @@ class EndpointHandler:
|
|
| 24 |
# self.model = model
|
| 25 |
# self.device = device
|
| 26 |
|
| 27 |
-
def __call__(self, data):
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
| 30 |
# def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
| 31 |
# """
|
| 32 |
# data args:
|
|
|
|
| 24 |
# self.model = model
|
| 25 |
# self.device = device
|
| 26 |
|
| 27 |
+
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
| 28 |
+
inputs = data.get("inputs", "")
|
| 29 |
+
if not inputs:
|
| 30 |
+
return [{"error": "No inputs provided"}]
|
| 31 |
+
|
| 32 |
+
return inputs
|
| 33 |
# def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
| 34 |
# """
|
| 35 |
# data args:
|
test_inference_endpoint.py
CHANGED
|
@@ -19,7 +19,7 @@ def call(payload):
|
|
| 19 |
response = requests.post(
|
| 20 |
URL,
|
| 21 |
headers=headers,
|
| 22 |
-
json=
|
| 23 |
)
|
| 24 |
print(response)
|
| 25 |
return response.json()
|
|
|
|
| 19 |
response = requests.post(
|
| 20 |
URL,
|
| 21 |
headers=headers,
|
| 22 |
+
json={'inputs': 'yo'}
|
| 23 |
)
|
| 24 |
print(response)
|
| 25 |
return response.json()
|