xcurvnubaim commited on
Commit
1775e4d
·
1 Parent(s): 349b9d7

feat: add cors

Browse files
Files changed (1) hide show
  1. main.py +9 -1
main.py CHANGED
@@ -7,9 +7,17 @@ from ultralytics import YOLO
7
  import cv2
8
  from datetime import datetime
9
  from fastapi.responses import FileResponse
10
-
11
  app = FastAPI()
12
 
 
 
 
 
 
 
 
 
13
  labels = []
14
  classification_model = tf.keras.models.load_model('./models.h5')
15
  detection_model = YOLO('./best.pt')
 
7
  import cv2
8
  from datetime import datetime
9
  from fastapi.responses import FileResponse
10
+ from fastapi.middleware.cors import CORSMiddleware
11
  app = FastAPI()
12
 
13
+ app.add_middleware(
14
+ CORSMiddleware,
15
+ allow_origins=["*"],
16
+ allow_credentials=True,
17
+ allow_methods=["*"],
18
+ allow_headers=["*"],
19
+ )
20
+
21
  labels = []
22
  classification_model = tf.keras.models.load_model('./models.h5')
23
  detection_model = YOLO('./best.pt')