Spaces:
Running
on
Zero
Running
on
Zero
Lord-Raven
commited on
Commit
·
1602927
1
Parent(s):
9119ff0
Adding another allowed origin. Added some CUDA logging--thinking about making some upgrades.
Browse files
app.py
CHANGED
@@ -17,12 +17,15 @@ app = FastAPI()
|
|
17 |
|
18 |
app.add_middleware(
|
19 |
CORSMiddleware,
|
20 |
-
allow_origins=["https://statosphere-3704059fdd7e.c5v4v4jx6pq5.win","https://crunchatize-77a78ffcc6a6.c5v4v4jx6pq5.win","https://tamabotchi-2dba63df3bf1.c5v4v4jx6pq5.win","https://lord-raven.github.io"],
|
21 |
allow_credentials=True,
|
22 |
allow_methods=["*"],
|
23 |
allow_headers=["*"],
|
24 |
)
|
25 |
|
|
|
|
|
|
|
26 |
# class OnnxSetFitModel:
|
27 |
# def __init__(self, ort_model, tokenizer, model_head):
|
28 |
# self.ort_model = ort_model
|
@@ -94,7 +97,7 @@ classifier = pipeline(task="zero-shot-classification", model=model, tokenizer=to
|
|
94 |
|
95 |
def classify(data_string, request: gradio.Request):
|
96 |
if request:
|
97 |
-
if request.headers["origin"] not in ["https://statosphere-3704059fdd7e.c5v4v4jx6pq5.win", "https://crunchatize-77a78ffcc6a6.c5v4v4jx6pq5.win", "https://tamabotchi-2dba63df3bf1.c5v4v4jx6pq5.win", "https://ravenok-statosphere-backend.hf.space", "https://lord-raven.github.io"]:
|
98 |
return "{}"
|
99 |
data = json.loads(data_string)
|
100 |
# if 'task' in data and data['task'] == 'few_shot_classification':
|
|
|
17 |
|
18 |
app.add_middleware(
|
19 |
CORSMiddleware,
|
20 |
+
allow_origins=["https://statosphere-3704059fdd7e.c5v4v4jx6pq5.win","https://crunchatize-77a78ffcc6a6.c5v4v4jx6pq5.win","https://crunchatize-2-2b4f5b1479a6.c5v4v4jx6pq5.win","https://tamabotchi-2dba63df3bf1.c5v4v4jx6pq5.win","https://lord-raven.github.io"],
|
21 |
allow_credentials=True,
|
22 |
allow_methods=["*"],
|
23 |
allow_headers=["*"],
|
24 |
)
|
25 |
|
26 |
+
print(f"Is CUDA available: {torch.cuda.is_available()}")
|
27 |
+
print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}")
|
28 |
+
|
29 |
# class OnnxSetFitModel:
|
30 |
# def __init__(self, ort_model, tokenizer, model_head):
|
31 |
# self.ort_model = ort_model
|
|
|
97 |
|
98 |
def classify(data_string, request: gradio.Request):
|
99 |
if request:
|
100 |
+
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"]:
|
101 |
return "{}"
|
102 |
data = json.loads(data_string)
|
103 |
# if 'task' in data and data['task'] == 'few_shot_classification':
|