devZenaight commited on
Commit
2b7d4b5
·
1 Parent(s): 7257b79
Files changed (1) hide show
  1. app/main.py +4 -9
app/main.py CHANGED
@@ -71,12 +71,7 @@ async def log_requests(request: Request, call_next):
71
  # Configure CORS for Hugging Face Spaces
72
  app.add_middleware(
73
  CORSMiddleware,
74
- allow_origins=[
75
- "https://*.hf.space", # Allow Hugging Face Spaces domains
76
- "http://localhost:3000", # Allow local development
77
- "http://localhost:7860", # Allow local Hugging Face Space
78
- "https://huggingface.co", # Allow Hugging Face main domain
79
- ],
80
  allow_credentials=True,
81
  allow_methods=["*"],
82
  allow_headers=["*"],
@@ -214,7 +209,7 @@ def get_llm(model_name: str, provider: str = "hf-inference"):
214
  model_name="gpt-4.1-mini",
215
  temperature=0.7,
216
  max_tokens=6000,
217
- api_key=openai_api_key
218
  )
219
  elif model_name == "BPSuggestionsAI":
220
  openai_api_key = os.getenv("OPENAI_API_KEY")
@@ -225,7 +220,7 @@ def get_llm(model_name: str, provider: str = "hf-inference"):
225
  model_name="gpt-4.1-nano",
226
  temperature=0.7,
227
  max_tokens=4000,
228
- api_key=openai_api_key
229
  )
230
  elif model_name.lower() == "gpt-4.1-nano":
231
  openai_api_key = os.getenv("OPENAI_API_KEY")
@@ -235,7 +230,7 @@ def get_llm(model_name: str, provider: str = "hf-inference"):
235
  model_name="gpt-4.1-nano",
236
  temperature=0.7,
237
  max_tokens=4000,
238
- api_key=openai_api_key
239
  )
240
  else:
241
  # For all other models, use the specified provider
 
71
  # Configure CORS for Hugging Face Spaces
72
  app.add_middleware(
73
  CORSMiddleware,
74
+ allow_origins=["*"],
 
 
 
 
 
75
  allow_credentials=True,
76
  allow_methods=["*"],
77
  allow_headers=["*"],
 
209
  model_name="gpt-4.1-mini",
210
  temperature=0.7,
211
  max_tokens=6000,
212
+ openai_api_key=openai_api_key
213
  )
214
  elif model_name == "BPSuggestionsAI":
215
  openai_api_key = os.getenv("OPENAI_API_KEY")
 
220
  model_name="gpt-4.1-nano",
221
  temperature=0.7,
222
  max_tokens=4000,
223
+ openai_api_key=openai_api_key
224
  )
225
  elif model_name.lower() == "gpt-4.1-nano":
226
  openai_api_key = os.getenv("OPENAI_API_KEY")
 
230
  model_name="gpt-4.1-nano",
231
  temperature=0.7,
232
  max_tokens=4000,
233
+ openai_api_key=openai_api_key
234
  )
235
  else:
236
  # For all other models, use the specified provider