Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +10 -3
src/streamlit_app.py
CHANGED
|
@@ -4,6 +4,12 @@ from pinecone import Pinecone
|
|
| 4 |
from groq import Groq
|
| 5 |
import uuid
|
| 6 |
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# -------------------------------
|
| 9 |
# Page Configuration
|
|
@@ -185,20 +191,21 @@ def load_models():
|
|
| 185 |
with st.spinner("🤖 Loading AI models..."):
|
| 186 |
embed_model = SentenceTransformer(
|
| 187 |
"google/embeddinggemma-300m",
|
| 188 |
-
token=
|
| 189 |
)
|
|
|
|
| 190 |
reranker = CrossEncoder("cross-encoder/ms-marco-MiniLM-L-6-v2")
|
| 191 |
return embed_model, reranker
|
| 192 |
|
| 193 |
@st.cache_resource(show_spinner=False)
|
| 194 |
def initialize_pinecone():
|
| 195 |
-
pc = Pinecone(api_key=
|
| 196 |
index = pc.Index("rag")
|
| 197 |
return index
|
| 198 |
|
| 199 |
@st.cache_resource(show_spinner=False)
|
| 200 |
def initialize_groq():
|
| 201 |
-
client = Groq(api_key=
|
| 202 |
return client
|
| 203 |
|
| 204 |
# Initialize models and services
|
|
|
|
| 4 |
from groq import Groq
|
| 5 |
import uuid
|
| 6 |
import time
|
| 7 |
+
import os
|
| 8 |
+
|
| 9 |
+
HF_TOKEN = os.environ.get("HF_TOKEN")
|
| 10 |
+
PINECONE_API_KEY = os.environ.get("PINECONE_API_KEY")
|
| 11 |
+
GROQ_API_KEY = os.environ.get("GROQ_API_KEY")
|
| 12 |
+
|
| 13 |
|
| 14 |
# -------------------------------
|
| 15 |
# Page Configuration
|
|
|
|
| 191 |
with st.spinner("🤖 Loading AI models..."):
|
| 192 |
embed_model = SentenceTransformer(
|
| 193 |
"google/embeddinggemma-300m",
|
| 194 |
+
token=HF_TOKEN
|
| 195 |
)
|
| 196 |
+
|
| 197 |
reranker = CrossEncoder("cross-encoder/ms-marco-MiniLM-L-6-v2")
|
| 198 |
return embed_model, reranker
|
| 199 |
|
| 200 |
@st.cache_resource(show_spinner=False)
|
| 201 |
def initialize_pinecone():
|
| 202 |
+
pc = Pinecone(api_key=PINECONE_API_KEY)
|
| 203 |
index = pc.Index("rag")
|
| 204 |
return index
|
| 205 |
|
| 206 |
@st.cache_resource(show_spinner=False)
|
| 207 |
def initialize_groq():
|
| 208 |
+
client = Groq(api_key=GROQ_API_KEY)
|
| 209 |
return client
|
| 210 |
|
| 211 |
# Initialize models and services
|