Spaces:
Sleeping
Sleeping
backend commit
Browse files- app/main.py +3 -2
- requirements.txt +3 -2
app/main.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from fastapi import FastAPI, HTTPException
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
import pandas as pd
|
| 4 |
import uvicorn
|
|
@@ -19,6 +19,7 @@ logger = logging.getLogger(__name__)
|
|
| 19 |
load_dotenv()
|
| 20 |
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
|
| 21 |
if not GROQ_API_KEY:
|
|
|
|
| 22 |
raise Exception("GROQ_API_KEY not found in environment variables.")
|
| 23 |
|
| 24 |
# Log and clear proxy environment variables to avoid 'proxies' error
|
|
@@ -29,7 +30,7 @@ os.environ.pop("HTTPS_PROXY", None)
|
|
| 29 |
os.environ.pop("NO_PROXY", None)
|
| 30 |
logger.info("Proxy environment variables cleared to prevent 'proxies' error.")
|
| 31 |
|
| 32 |
-
# Initialize Groq client
|
| 33 |
try:
|
| 34 |
client = Groq(api_key=GROQ_API_KEY)
|
| 35 |
logger.info("Groq client initialized successfully.")
|
|
|
|
| 1 |
+
from fastapi import FastAPI, HTTPException
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
import pandas as pd
|
| 4 |
import uvicorn
|
|
|
|
| 19 |
load_dotenv()
|
| 20 |
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
|
| 21 |
if not GROQ_API_KEY:
|
| 22 |
+
logger.error("GROQ_API_KEY not found in environment variables.")
|
| 23 |
raise Exception("GROQ_API_KEY not found in environment variables.")
|
| 24 |
|
| 25 |
# Log and clear proxy environment variables to avoid 'proxies' error
|
|
|
|
| 30 |
os.environ.pop("NO_PROXY", None)
|
| 31 |
logger.info("Proxy environment variables cleared to prevent 'proxies' error.")
|
| 32 |
|
| 33 |
+
# Initialize Groq client
|
| 34 |
try:
|
| 35 |
client = Groq(api_key=GROQ_API_KEY)
|
| 36 |
logger.info("Groq client initialized successfully.")
|
requirements.txt
CHANGED
|
@@ -4,5 +4,6 @@ pandas==2.0.3
|
|
| 4 |
plotly==5.15.0
|
| 5 |
joblib==1.3.2
|
| 6 |
numpy==1.25.2
|
| 7 |
-
groq==0.
|
| 8 |
-
python-dotenv==1.0.0
|
|
|
|
|
|
| 4 |
plotly==5.15.0
|
| 5 |
joblib==1.3.2
|
| 6 |
numpy==1.25.2
|
| 7 |
+
groq==0.11.0
|
| 8 |
+
python-dotenv==1.0.0
|
| 9 |
+
httpx==0.27.0
|