davanstrien HF staff commited on
Commit
c616690
1 Parent(s): 6bf0c73

Add CORS configuration for frontend URL

Browse files
Files changed (1) hide show
  1. main.py +16 -16
main.py CHANGED
@@ -64,22 +64,22 @@ async def lifespan(app: FastAPI):
64
 
65
  app = FastAPI() # )lifespan=lifespan)
66
  # Configure CORS
67
- # origins = [
68
- # "https://huggingface.co",
69
- # "chrome-extension://deckahggoiaphiebdipfbiinmaihfpbk", # Replace with your Chrome plugin ID
70
- # ]
71
-
72
-
73
- # # Configure CORS settings
74
- # app.add_middleware(
75
- # CORSMiddleware,
76
- # allow_origins=[
77
- # "https://huggingface.co/datasets/*"
78
- # ], # Update with your frontend URL
79
- # allow_credentials=True,
80
- # allow_methods=["*"],
81
- # allow_headers=["*"],
82
- # )
83
 
84
 
85
  def save_vote(vote_entry):
 
64
 
65
  app = FastAPI() # )lifespan=lifespan)
66
  # Configure CORS
67
+ origins = [
68
+ "https://huggingface.co",
69
+ "chrome-extension://deckahggoiaphiebdipfbiinmaihfpbk", # Replace with your Chrome plugin ID
70
+ ]
71
+
72
+
73
+ # Configure CORS settings
74
+ app.add_middleware(
75
+ CORSMiddleware,
76
+ allow_origins=[
77
+ "https://huggingface.co/datasets/*"
78
+ ], # Update with your frontend URL
79
+ allow_credentials=True,
80
+ allow_methods=["*"],
81
+ allow_headers=["*"],
82
+ )
83
 
84
 
85
  def save_vote(vote_entry):