menimeni123
commited on
Commit
•
1b297c3
1
Parent(s):
c48a85b
handler receive input
Browse files- handler.py +2 -0
handler.py
CHANGED
@@ -8,6 +8,8 @@ class EndpointHandler:
|
|
8 |
self.label_mapping = {0: "SAFE", 1: "JAILBREAK", 2: "INJECTION", 3: "PHISHING"}
|
9 |
|
10 |
def __call__(self, inputs):
|
|
|
|
|
11 |
return self.predict(inputs)
|
12 |
|
13 |
def predict(self, inputs):
|
|
|
8 |
self.label_mapping = {0: "SAFE", 1: "JAILBREAK", 2: "INJECTION", 3: "PHISHING"}
|
9 |
|
10 |
def __call__(self, inputs):
|
11 |
+
if isinstance(inputs, dict) and 'inputs' in inputs:
|
12 |
+
return self.predict(inputs['inputs'])
|
13 |
return self.predict(inputs)
|
14 |
|
15 |
def predict(self, inputs):
|