RohanVashisht commited on
Commit
e67057e
·
verified ·
1 Parent(s): 4121aea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -1,11 +1,20 @@
1
  import faiss
2
  import numpy as np
3
  from fastapi import FastAPI, Query
 
4
  from datasets import load_dataset
5
  from sentence_transformers import SentenceTransformer
6
 
7
  app = FastAPI()
8
 
 
 
 
 
 
 
 
 
9
  FIELDS = (
10
  "full_name", "description", "watchers_count", "forks_count", "license",
11
  "default_branch", "has_build_zig", "has_build_zig_zon", "fork",
 
1
  import faiss
2
  import numpy as np
3
  from fastapi import FastAPI, Query
4
+ from fastapi.middleware.cors import CORSMiddleware
5
  from datasets import load_dataset
6
  from sentence_transformers import SentenceTransformer
7
 
8
  app = FastAPI()
9
 
10
+ app.add_middleware(
11
+ CORSMiddleware,
12
+ allow_origins=["*"], # Change this to specific origins if needed for security
13
+ allow_credentials=True,
14
+ allow_methods=["*"],
15
+ allow_headers=["*"],
16
+ )
17
+
18
  FIELDS = (
19
  "full_name", "description", "watchers_count", "forks_count", "license",
20
  "default_branch", "has_build_zig", "has_build_zig_zon", "fork",