Skip to content

Commit

Permalink
cors middlewire update
Browse files Browse the repository at this point in the history
  • Loading branch information
AshishMahendra committed Apr 15, 2024
1 parent c3e7b1a commit 009e796
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions local_gpt_fast_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from langchain.chains import RetrievalQA
from langchain.embeddings import HuggingFaceInstructEmbeddings
import traceback
from fastapi.middleware.cors import CORSMiddleware

from run_localGPT import load_model
from prompt_template_utils import get_prompt_template
Expand Down Expand Up @@ -87,7 +88,13 @@ class DocumentData(BaseModel):


app = FastAPI()

app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)

def reinitialize_components():
global DB, RETRIEVER, QA
Expand Down Expand Up @@ -177,4 +184,4 @@ def receive_feedback(feedback: FeedbackModel):


if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=8500)
uvicorn.run(app, host="0.0.0.0", port=8500)

0 comments on commit 009e796

Please sign in to comment.