AyoubChLin commited on
Commit
7c1f442
·
verified ·
1 Parent(s): bea8dac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -1,5 +1,6 @@
1
  from fastapi import FastAPI, UploadFile, File, HTTPException
2
  from fastapi.responses import JSONResponse
 
3
  import shutil
4
  import os
5
  from uuid import uuid4
@@ -10,6 +11,15 @@ from threading import Lock
10
 
11
  app = FastAPI()
12
 
 
 
 
 
 
 
 
 
 
13
  # Singleton class for PdfConverter
14
  class PdfConverterSingleton:
15
  _instance = None
 
1
  from fastapi import FastAPI, UploadFile, File, HTTPException
2
  from fastapi.responses import JSONResponse
3
+ from fastapi.middleware.cors import CORSMiddleware
4
  import shutil
5
  import os
6
  from uuid import uuid4
 
11
 
12
  app = FastAPI()
13
 
14
+ # Enable CORS for all origins
15
+ app.add_middleware(
16
+ CORSMiddleware,
17
+ allow_origins=["*"], # Allow all origins
18
+ allow_credentials=True,
19
+ allow_methods=["*"], # Allow all HTTP methods
20
+ allow_headers=["*"], # Allow all headers
21
+ )
22
+
23
  # Singleton class for PdfConverter
24
  class PdfConverterSingleton:
25
  _instance = None