CooLLaMACEO commited on
Commit
f0f547d
·
verified ·
1 Parent(s): 0e6813b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -1,7 +1,15 @@
1
  from fastapi import FastAPI, Request, HTTPException, Depends
2
  from llama_cpp import Llama
 
3
 
4
  app = FastAPI()
 
 
 
 
 
 
 
5
 
6
  # --- SET YOUR API KEY HERE ---
7
  MY_API_KEY = "my-secret-key-456"
 
1
  from fastapi import FastAPI, Request, HTTPException, Depends
2
  from llama_cpp import Llama
3
+ from fastapi.middleware.cors import CORSMiddleware
4
 
5
  app = FastAPI()
6
+ app.add_middleware(
7
+ CORSMiddleware,
8
+ allow_origins=["*"], # This allows GitHub Pages to talk to your API
9
+ allow_credentials=True,
10
+ allow_methods=["*"],
11
+ allow_headers=["*"],
12
+ )
13
 
14
  # --- SET YOUR API KEY HERE ---
15
  MY_API_KEY = "my-secret-key-456"