Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,7 @@ from bs4 import BeautifulSoup
|
|
| 8 |
from typing import List, Dict
|
| 9 |
import asyncio
|
| 10 |
import re
|
|
|
|
| 11 |
app = FastAPI()
|
| 12 |
|
| 13 |
app.add_middleware(
|
|
@@ -451,7 +452,11 @@ async def generate_text(request: Request):
|
|
| 451 |
stream = body.get("stream", False)
|
| 452 |
|
| 453 |
if provider == "groq":
|
| 454 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 455 |
if not API_KEY:
|
| 456 |
raise HTTPException(500, "Missing GROQ_KEY")
|
| 457 |
|
|
|
|
| 8 |
from typing import List, Dict
|
| 9 |
import asyncio
|
| 10 |
import re
|
| 11 |
+
from random import randint
|
| 12 |
app = FastAPI()
|
| 13 |
|
| 14 |
app.add_middleware(
|
|
|
|
| 452 |
stream = body.get("stream", False)
|
| 453 |
|
| 454 |
if provider == "groq":
|
| 455 |
+
const num = randint(1, 2)
|
| 456 |
+
if num == 1:
|
| 457 |
+
API_KEY = os.getenv("GROQ_KEY", "")
|
| 458 |
+
elif num == 2:
|
| 459 |
+
API_KEY = os.getenv("GROQ2_KEY", "")
|
| 460 |
if not API_KEY:
|
| 461 |
raise HTTPException(500, "Missing GROQ_KEY")
|
| 462 |
|