Update app.py
Browse files
app.py
CHANGED
@@ -4,11 +4,15 @@ import pdfplumber
|
|
4 |
import os
|
5 |
import gc
|
6 |
|
7 |
-
#
|
8 |
-
os.
|
9 |
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
12 |
|
13 |
def generate_response_groq(context, query):
|
14 |
"""Generate response using Groq API."""
|
|
|
4 |
import os
|
5 |
import gc
|
6 |
|
7 |
+
# No need for load_dotenv() since Hugging Face automatically loads secrets as environment variables
|
8 |
+
api_key = os.getenv("GROQ_API_KEY")
|
9 |
|
10 |
+
if not api_key:
|
11 |
+
st.error("Groq API key not found. Please check your environment variables.")
|
12 |
+
st.stop() # Stop execution if API key is missing
|
13 |
+
|
14 |
+
# Initialize the Groq client with the API key
|
15 |
+
client = Groq(api_key=api_key)
|
16 |
|
17 |
def generate_response_groq(context, query):
|
18 |
"""Generate response using Groq API."""
|