Upload folder using huggingface_hub
Browse files- __pycache__/handler.cpython-311.pyc +0 -0
- handler.py +3 -3
- test_endpoint.py +2 -2
__pycache__/handler.cpython-311.pyc
ADDED
|
Binary file (6.35 kB). View file
|
|
|
handler.py
CHANGED
|
@@ -17,12 +17,12 @@ class EndpointHandler:
|
|
| 17 |
|
| 18 |
def __call__(self, data: Dict[str, Any]) -> Any:
|
| 19 |
if "inputs" in data:
|
| 20 |
-
messages = data["inputs"]
|
| 21 |
else:
|
| 22 |
return {"error": "Invalid format -- expected key 'inputs'"}
|
| 23 |
|
| 24 |
-
if "settings" in data:
|
| 25 |
-
settings = data["settings"]
|
| 26 |
else:
|
| 27 |
return {"error": "Invalid format -- expected key 'settings' with the following: use_expert, tokenizer_max_length, do_sample, temperature, top_k, top_p, num_beams, max_new_tokens"}
|
| 28 |
|
|
|
|
| 17 |
|
| 18 |
def __call__(self, data: Dict[str, Any]) -> Any:
|
| 19 |
if "inputs" in data:
|
| 20 |
+
messages = data["inputs"]["messages"]
|
| 21 |
else:
|
| 22 |
return {"error": "Invalid format -- expected key 'inputs'"}
|
| 23 |
|
| 24 |
+
if "settings" in data["inputs"].keys():
|
| 25 |
+
settings = data["inputs"]["settings"]
|
| 26 |
else:
|
| 27 |
return {"error": "Invalid format -- expected key 'settings' with the following: use_expert, tokenizer_max_length, do_sample, temperature, top_k, top_p, num_beams, max_new_tokens"}
|
| 28 |
|
test_endpoint.py
CHANGED
|
@@ -25,8 +25,8 @@ settings = {"use_expert":True,
|
|
| 25 |
"max_new_tokens":700}
|
| 26 |
|
| 27 |
payload = {
|
| 28 |
-
"inputs": messages,
|
| 29 |
-
|
| 30 |
}
|
| 31 |
|
| 32 |
endpoint = EndpointHandler()
|
|
|
|
| 25 |
"max_new_tokens":700}
|
| 26 |
|
| 27 |
payload = {
|
| 28 |
+
"inputs": {"messages":messages,
|
| 29 |
+
"settings":settings}
|
| 30 |
}
|
| 31 |
|
| 32 |
endpoint = EndpointHandler()
|