Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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"
|
| 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 =
|
| 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=
|
| 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 |
|