Spaces:
Running
on
Zero
Running
on
Zero
Lord-Raven
commited on
Commit
·
6b9e813
1
Parent(s):
7badb14
Playing with different models.
Browse files- README.md +0 -2
- app.py +9 -0
- requirements.txt +1 -0
README.md
CHANGED
@@ -8,8 +8,6 @@ sdk_version: 4.41.0
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: openrail
|
11 |
-
custom_headers:
|
12 |
-
access-control-allow-origin: https://statosphere-3704059fdd7e.c5v4v4jx6pq5.win
|
13 |
---
|
14 |
|
15 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: openrail
|
|
|
|
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
@@ -2,9 +2,18 @@ import gradio
|
|
2 |
import json
|
3 |
from transformers import pipeline
|
4 |
from transformers import AutoTokenizer
|
|
|
5 |
|
6 |
classifier = pipeline(task='zero-shot-classification', model='tasksource/deberta-small-long-nli', device=0)
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
def zero_shot_classification(data_string):
|
9 |
print(data_string)
|
10 |
data = json.loads(data_string)
|
|
|
2 |
import json
|
3 |
from transformers import pipeline
|
4 |
from transformers import AutoTokenizer
|
5 |
+
from fastapi.middleware.cors import CORSMiddleware
|
6 |
|
7 |
classifier = pipeline(task='zero-shot-classification', model='tasksource/deberta-small-long-nli', device=0)
|
8 |
|
9 |
+
app.add_middleware(
|
10 |
+
CORSMiddleware,
|
11 |
+
allow_origins=:"[https://statosphere-3704059fdd7e.c5v4v4jx6pq5.win]",
|
12 |
+
allow_credentials=False,
|
13 |
+
allow_methods=["*"],
|
14 |
+
allow_headers=["*"],
|
15 |
+
)
|
16 |
+
|
17 |
def zero_shot_classification(data_string):
|
18 |
print(data_string)
|
19 |
data = json.loads(data_string)
|
requirements.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
json5==0.9.10
|
2 |
numpy==1.23.4
|
3 |
torch==1.12.1
|
|
|
1 |
+
fastapi==0.88.0
|
2 |
json5==0.9.10
|
3 |
numpy==1.23.4
|
4 |
torch==1.12.1
|