Lord-Raven commited on
Commit
04b11ba
·
1 Parent(s): 84cb97f

Removing domain check.

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -9,7 +9,7 @@ from transformers import pipeline
9
  from fastapi import FastAPI
10
  from fastapi.middleware.cors import CORSMiddleware
11
 
12
- # CORS Config - This isn't actually working; instead, I am taking a gross approach to origin whitelisting within the service.
13
  app = FastAPI()
14
 
15
  app.add_middleware(
@@ -35,9 +35,7 @@ classifier_cpu = pipeline(task="zero-shot-classification", model=model_name_cpu,
35
  classifier_gpu = pipeline(task="zero-shot-classification", model=model_name_gpu, tokenizer=tokenizer_name_gpu, device="cuda", torch_dtype=torch.bfloat16) if torch.cuda.is_available() else classifier_cpu
36
 
37
  def classify(data_string, request: gradio.Request):
38
- if request:
39
- 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://expressions-plus-plus-a8db5f0bd422.c5v4v4jx6pq5.win", "https://crunchatize-zero-55cf8960d31a.c5v4v4jx6pq5.win", "https://misty-mississippi-87473a288fb9.c5v4v4jx6pq5.win", "https://ravenok-statosphere-backend.hf.space", "https://ravenok-test-space.hf.space", "https://lord-raven.github.io"]:
40
- return "{}"
41
  data = json.loads(data_string)
42
 
43
  # Try to prevent batch suggestion warning in log.
 
9
  from fastapi import FastAPI
10
  from fastapi.middleware.cors import CORSMiddleware
11
 
12
+ # CORS Config - This isn't actually working. I probably don't want this any more.
13
  app = FastAPI()
14
 
15
  app.add_middleware(
 
35
  classifier_gpu = pipeline(task="zero-shot-classification", model=model_name_gpu, tokenizer=tokenizer_name_gpu, device="cuda", torch_dtype=torch.bfloat16) if torch.cuda.is_available() else classifier_cpu
36
 
37
  def classify(data_string, request: gradio.Request):
38
+
 
 
39
  data = json.loads(data_string)
40
 
41
  # Try to prevent batch suggestion warning in log.