Makhinur commited on
Commit
4b2dc54
·
verified ·
1 Parent(s): d6b44d2

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -5
main.py CHANGED
@@ -48,7 +48,7 @@ from fastapi.middleware.cors import CORSMiddleware
48
 
49
  app.add_middleware(
50
  CORSMiddleware,
51
- allow_origins=["https://artixiban-ll3.static.hf.space"], # Allow only this origin
52
  allow_credentials=True,
53
  allow_methods=["*"], # Allow all methods (GET, POST, etc.)
54
  allow_headers=["*"], # Allow all headers
@@ -56,10 +56,7 @@ app.add_middleware(
56
 
57
  @app.post("/generate/")
58
  async def generate(request: Request):
59
- allowed_origin = "https://artixiban-ll3.static.hf.space"
60
- origin = request.headers.get("origin")
61
- if origin != allowed_origin:
62
- raise HTTPException(status_code=403, detail="Origin not allowed")
63
  form = await request.form()
64
  prompt = form.get("prompt")
65
  history = json.loads(form.get("history", "[]")) # Default to empty history
 
48
 
49
  app.add_middleware(
50
  CORSMiddleware,
51
+ allow_origins=["*"], # Allow only this origin
52
  allow_credentials=True,
53
  allow_methods=["*"], # Allow all methods (GET, POST, etc.)
54
  allow_headers=["*"], # Allow all headers
 
56
 
57
  @app.post("/generate/")
58
  async def generate(request: Request):
59
+
 
 
 
60
  form = await request.form()
61
  prompt = form.get("prompt")
62
  history = json.loads(form.get("history", "[]")) # Default to empty history