Spaces:
Running
on
Zero
Running
on
Zero
Lord-Raven
commited on
Commit
·
2bf9da4
1
Parent(s):
c92ceac
Messing with configuration.
Browse files
app.py
CHANGED
|
@@ -95,7 +95,7 @@ classifier = pipeline(task="zero-shot-classification", model=model, tokenizer=to
|
|
| 95 |
# onnx_few_shot_model = OnnxSetFitModel(ort_model, few_shot_tokenizer, few_shot_model.model_head)
|
| 96 |
|
| 97 |
|
| 98 |
-
|
| 99 |
def classify(data_string, request: gradio.Request):
|
| 100 |
if request:
|
| 101 |
if request.headers["origin"] not in ["https://statosphere-3704059fdd7e.c5v4v4jx6pq5.win", "https://crunchatize-77a78ffcc6a6.c5v4v4jx6pq5.win", "https://crunchatize-2-2b4f5b1479a6.c5v4v4jx6pq5.win", "https://tamabotchi-2dba63df3bf1.c5v4v4jx6pq5.win", "https://ravenok-statosphere-backend.hf.space", "https://lord-raven.github.io"]:
|
|
@@ -106,6 +106,7 @@ def classify(data_string, request: gradio.Request):
|
|
| 106 |
# else:
|
| 107 |
return zero_shot_classification(data)
|
| 108 |
|
|
|
|
| 109 |
def zero_shot_classification(data):
|
| 110 |
results = classifier(data['sequence'], candidate_labels=data['candidate_labels'], hypothesis_template=data['hypothesis_template'], multi_label=data['multi_label'])
|
| 111 |
response_string = json.dumps(results)
|
|
|
|
| 95 |
# onnx_few_shot_model = OnnxSetFitModel(ort_model, few_shot_tokenizer, few_shot_model.model_head)
|
| 96 |
|
| 97 |
|
| 98 |
+
|
| 99 |
def classify(data_string, request: gradio.Request):
|
| 100 |
if request:
|
| 101 |
if request.headers["origin"] not in ["https://statosphere-3704059fdd7e.c5v4v4jx6pq5.win", "https://crunchatize-77a78ffcc6a6.c5v4v4jx6pq5.win", "https://crunchatize-2-2b4f5b1479a6.c5v4v4jx6pq5.win", "https://tamabotchi-2dba63df3bf1.c5v4v4jx6pq5.win", "https://ravenok-statosphere-backend.hf.space", "https://lord-raven.github.io"]:
|
|
|
|
| 106 |
# else:
|
| 107 |
return zero_shot_classification(data)
|
| 108 |
|
| 109 |
+
@spaces.GPU
|
| 110 |
def zero_shot_classification(data):
|
| 111 |
results = classifier(data['sequence'], candidate_labels=data['candidate_labels'], hypothesis_template=data['hypothesis_template'], multi_label=data['multi_label'])
|
| 112 |
response_string = json.dumps(results)
|