Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,17 +11,23 @@ import os
|
|
11 |
from dotenv import load_dotenv
|
12 |
import pdfplumber # Alternative PDF library
|
13 |
|
14 |
-
|
15 |
-
load_dotenv()
|
16 |
-
|
17 |
-
# --- Retrieve API Key ---
|
18 |
-
API_KEY = os.getenv("OPENROUTER_API_KEY")
|
19 |
if not API_KEY:
|
20 |
-
st.error("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
st.stop()
|
22 |
|
|
|
23 |
API_URL = "https://api.groq.com/openai/v1/chat/completions"
|
24 |
-
MODEL = "llama3-70b-8192"
|
25 |
|
26 |
# Set Tesseract path for different environments
|
27 |
try:
|
|
|
11 |
from dotenv import load_dotenv
|
12 |
import pdfplumber # Alternative PDF library
|
13 |
|
14 |
+
API_KEY = os.environ.get('OPENROUTER_API_KEY')
|
|
|
|
|
|
|
|
|
15 |
if not API_KEY:
|
16 |
+
st.error("""
|
17 |
+
**API Key Not Configured!**
|
18 |
+
|
19 |
+
Please add your API key to Hugging Face Spaces secrets:
|
20 |
+
1. Go to your Space settings
|
21 |
+
2. Select "Variables and secrets"
|
22 |
+
3. Add a secret named: `OPENROUTER_API_KEY`
|
23 |
+
4. Set its value to your actual API key
|
24 |
+
5. Redeploy the space
|
25 |
+
""")
|
26 |
st.stop()
|
27 |
|
28 |
+
# --- API Configuration ---
|
29 |
API_URL = "https://api.groq.com/openai/v1/chat/completions"
|
30 |
+
MODEL = "llama3-70b-8192"
|
31 |
|
32 |
# Set Tesseract path for different environments
|
33 |
try:
|