khalednabawi11 commited on
Commit
bde5081
·
verified ·
1 Parent(s): 187480b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -225,6 +225,7 @@ from pydantic import BaseModel, Field
225
  import time
226
  import asyncio
227
  from concurrent.futures import ThreadPoolExecutor
 
228
 
229
  logging.basicConfig(level=logging.INFO)
230
  logger = logging.getLogger(__name__)
@@ -241,6 +242,17 @@ tokenizer.pad_token = tokenizer.eos_token
241
 
242
  app = FastAPI(title="Apollo RAG Medical Chatbot")
243
 
 
 
 
 
 
 
 
 
 
 
 
244
  generation_config = GenerationConfig(
245
  max_new_tokens=150,
246
  temperature=0.2,
 
225
  import time
226
  import asyncio
227
  from concurrent.futures import ThreadPoolExecutor
228
+ from fastapi.middleware.cors import CORSMiddleware
229
 
230
  logging.basicConfig(level=logging.INFO)
231
  logger = logging.getLogger(__name__)
 
242
 
243
  app = FastAPI(title="Apollo RAG Medical Chatbot")
244
 
245
+ # Add this after creating the `app`
246
+ app.add_middleware(
247
+ CORSMiddleware,
248
+ allow_origins=["*"], # Allow all origins
249
+ allow_credentials=True,
250
+ allow_methods=["*"],
251
+ allow_headers=["*"],
252
+ )
253
+
254
+
255
+
256
  generation_config = GenerationConfig(
257
  max_new_tokens=150,
258
  temperature=0.2,