Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,18 +7,10 @@ from langchain.embeddings import HuggingFaceEmbeddings
|
|
| 7 |
from langchain.vectorstores import FAISS
|
| 8 |
from langchain.chains import RetrievalQA
|
| 9 |
|
| 10 |
-
import os
|
| 11 |
-
os.environ["GROQ_API_KEY"] = "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"
|
| 12 |
-
|
| 13 |
def main():
|
| 14 |
-
#
|
| 15 |
-
groq_api_key =
|
| 16 |
|
| 17 |
-
# Check if API key is available
|
| 18 |
-
if not groq_api_key:
|
| 19 |
-
st.error("GROQ_API_KEY not found. Please set the environment variable.")
|
| 20 |
-
return
|
| 21 |
-
|
| 22 |
st.title("PDF Chat with Groq LLM")
|
| 23 |
|
| 24 |
# File uploader
|
|
@@ -52,7 +44,7 @@ def main():
|
|
| 52 |
llm = ChatGroq(
|
| 53 |
temperature=0.7,
|
| 54 |
model_name='llama3-70b-8192',
|
| 55 |
-
|
| 56 |
)
|
| 57 |
|
| 58 |
# Create QA chain
|
|
|
|
| 7 |
from langchain.vectorstores import FAISS
|
| 8 |
from langchain.chains import RetrievalQA
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
def main():
|
| 11 |
+
# Directly set the API key
|
| 12 |
+
groq_api_key = "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"
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
st.title("PDF Chat with Groq LLM")
|
| 15 |
|
| 16 |
# File uploader
|
|
|
|
| 44 |
llm = ChatGroq(
|
| 45 |
temperature=0.7,
|
| 46 |
model_name='llama3-70b-8192',
|
| 47 |
+
api_key=groq_api_key # Use api_key instead of groq_api_key
|
| 48 |
)
|
| 49 |
|
| 50 |
# Create QA chain
|