ujalaarshad17 commited on
Commit
1eeb284
·
1 Parent(s): 6c497f2

setted the n_threads

Browse files
Files changed (1) hide show
  1. main.py +9 -2
main.py CHANGED
@@ -1,4 +1,5 @@
1
  from fastapi import FastAPI, HTTPException
 
2
  from models import SQLContext
3
  from llama_cpp import Llama
4
  import logging
@@ -6,12 +7,18 @@ import logging
6
  llm = Llama(
7
  model_path="./quantized_model/sql_gpt_quantized.gguf",
8
  n_ctx=512,
9
- n_threads=1,
10
  n_gpu_layers=-1
11
  )
12
 
13
  app = FastAPI()
14
-
 
 
 
 
 
 
15
  @app.get("/")
16
  def root():
17
  return {"Hello": "World"}
 
1
  from fastapi import FastAPI, HTTPException
2
+ from fastapi.middleware.cors import CORSMiddleware
3
  from models import SQLContext
4
  from llama_cpp import Llama
5
  import logging
 
7
  llm = Llama(
8
  model_path="./quantized_model/sql_gpt_quantized.gguf",
9
  n_ctx=512,
10
+ n_threads=4
11
  n_gpu_layers=-1
12
  )
13
 
14
  app = FastAPI()
15
+ app.add_middleware(
16
+ CORSMiddleware,
17
+ allow_origins=["*"], # Allow your frontend origin
18
+ allow_credentials=True,
19
+ allow_methods=["*"], # Allow all methods
20
+ allow_headers=["*"], # Allow all headers
21
+ )
22
  @app.get("/")
23
  def root():
24
  return {"Hello": "World"}