Futuresony commited on
Commit
921ddbb
·
verified ·
1 Parent(s): d7d6472

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -7,7 +7,7 @@ from gradio_client import Client
7
  client = Client("Futuresony/Mr.Events")
8
 
9
  # Get your secure API key from environment
10
- VALID_API_KEY = os.getenv("APP_API_KEY", "fs_ABnWISBWhOlqLIn6FuFqPWo8dFgy1wrk0r4EA")
11
 
12
  app = FastAPI()
13
 
@@ -16,7 +16,7 @@ async def chat(request: Request):
16
  data = await request.json()
17
 
18
  # API Key Check
19
- api_key = data.get("api_key")
20
  if api_key != VALID_API_KEY:
21
  raise HTTPException(status_code=403, detail="Invalid API Key")
22
 
@@ -28,7 +28,7 @@ async def chat(request: Request):
28
  # Call the model hosted on your first space
29
  result = client.predict(
30
  query=user_message,
31
- api_key="fs_ABnWISBWhOlqLIn6FuFqPWo8dFgy1wrk0r4EA", # your hosted model's internal key if needed
32
  api_name="/chat"
33
  )
34
 
 
7
  client = Client("Futuresony/Mr.Events")
8
 
9
  # Get your secure API key from environment
10
+ VALID_API_KEY = os.getenv("APP_API_KEY")
11
 
12
  app = FastAPI()
13
 
 
16
  data = await request.json()
17
 
18
  # API Key Check
19
+ api_key = VALID_API_KEY
20
  if api_key != VALID_API_KEY:
21
  raise HTTPException(status_code=403, detail="Invalid API Key")
22
 
 
28
  # Call the model hosted on your first space
29
  result = client.predict(
30
  query=user_message,
31
+ api_key=VALID_API_KEY, # your hosted model's internal key if needed
32
  api_name="/chat"
33
  )
34