Spaces:
Running
on
Zero
Running
on
Zero
Lord-Raven
commited on
Commit
·
a822923
1
Parent(s):
50ca6a1
Trying to use ONNX model.
Browse files
app.py
CHANGED
@@ -27,8 +27,14 @@ tokenizer = AutoTokenizer.from_pretrained("typeform/mobilebert-uncased-mnli", mo
|
|
27 |
|
28 |
classifier = pipeline(task="zero-shot-classification", model=model, tokenizer=tokenizer)
|
29 |
|
30 |
-
def zero_shot_classification(data_string):
|
31 |
print(data_string)
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
data = json.loads(data_string)
|
33 |
print(data)
|
34 |
results = classifier(data['sequence'], candidate_labels=data['candidate_labels'], hypothesis_template=data['hypothesis_template'], multi_label=data['multi_label'])
|
|
|
27 |
|
28 |
classifier = pipeline(task="zero-shot-classification", model=model, tokenizer=tokenizer)
|
29 |
|
30 |
+
def zero_shot_classification(data_string, request: gradio.Request):
|
31 |
print(data_string)
|
32 |
+
if request:
|
33 |
+
print("Request headers dictionary:", request.headers)
|
34 |
+
print("IP address:", request.client.host)
|
35 |
+
print("Query parameters:", dict(request.query_params))
|
36 |
+
else:
|
37 |
+
print("No request")
|
38 |
data = json.loads(data_string)
|
39 |
print(data)
|
40 |
results = classifier(data['sequence'], candidate_labels=data['candidate_labels'], hypothesis_template=data['hypothesis_template'], multi_label=data['multi_label'])
|