matthoffner commited on
Commit
fb5554d
·
verified ·
1 Parent(s): 1cba699

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +8 -0
main.py CHANGED
@@ -1,5 +1,6 @@
1
  from llama_cpp.server.app import create_app, Settings
2
  from fastapi.responses import HTMLResponse
 
3
  import os
4
 
5
  app = create_app(
@@ -10,6 +11,13 @@ app = create_app(
10
  n_gpu_layers=33
11
  )
12
  )
 
 
 
 
 
 
 
13
 
14
  @app.get('/', response_class=HTMLResponse)
15
  def custom_index_route():
 
1
  from llama_cpp.server.app import create_app, Settings
2
  from fastapi.responses import HTMLResponse
3
+ from fastapi.middleware.cors import CORSMiddleware
4
  import os
5
 
6
  app = create_app(
 
11
  n_gpu_layers=33
12
  )
13
  )
14
+ app.add_middleware(
15
+ CORSMiddleware,
16
+ allow_origins=["*"],
17
+ allow_credentials=True,
18
+ allow_methods=["*"],
19
+ allow_headers=["*"],
20
+ )
21
 
22
  @app.get('/', response_class=HTMLResponse)
23
  def custom_index_route():