Jofthomas HF staff commited on
Commit
4c034f6
·
1 Parent(s): ccc7c0f

Restrict origins

Browse files
Files changed (1) hide show
  1. TextGen/router.py +11 -7
TextGen/router.py CHANGED
@@ -27,6 +27,17 @@ from elevenlabs import Voice, VoiceSettings, stream
27
  Eleven_client = ElevenLabs(
28
  api_key=os.environ["ELEVEN_API_KEY"], # Defaults to ELEVEN_API_KEY
29
  )
 
 
 
 
 
 
 
 
 
 
 
30
 
31
 
32
  Last_message=None
@@ -147,13 +158,6 @@ def generate_text(messages: List[str], npc:str):
147
  print(llm_response)
148
  return Generate(text=llm_response.content)
149
 
150
- app.add_middleware(
151
- CORSMiddleware,
152
- allow_origins=["*"],
153
- allow_credentials=True,
154
- allow_methods=["*"],
155
- allow_headers=["*"],
156
- )
157
 
158
  def inference_model(system_messsage, prompt):
159
 
 
27
  Eleven_client = ElevenLabs(
28
  api_key=os.environ["ELEVEN_API_KEY"], # Defaults to ELEVEN_API_KEY
29
  )
30
+ origins = [
31
+ "https://jofthomas-everchanging-quest.hf.space",
32
+ ]
33
+
34
+ app.add_middleware(
35
+ CORSMiddleware,
36
+ allow_origins=origins,
37
+ allow_credentials=True,
38
+ allow_methods=["*"],
39
+ allow_headers=["*"],
40
+ )
41
 
42
 
43
  Last_message=None
 
158
  print(llm_response)
159
  return Generate(text=llm_response.content)
160
 
 
 
 
 
 
 
 
161
 
162
  def inference_model(system_messsage, prompt):
163