Spaces:
Runtime error
Runtime error
Commit
·
24346f2
1
Parent(s):
ae84b7b
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,15 @@ import logging
|
|
6 |
PINECONE_KEY = st.secrets["PINECONE_KEY"] # app.pinecone.io
|
7 |
INDEX_ID = 'ask-youtube'
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
@st.experimental_singleton
|
10 |
def init_pinecone():
|
11 |
pinecone.init(api_key=PINECONE_KEY, environment="us-west1-gcp")
|
@@ -40,6 +49,7 @@ def make_query(query, retriever, top_k=10, include_values=True, include_metadata
|
|
40 |
logging.error(f"Query failed")
|
41 |
return matches
|
42 |
|
|
|
43 |
st.session_state.index = init_pinecone()
|
44 |
retriever = init_retriever()
|
45 |
|
|
|
6 |
PINECONE_KEY = st.secrets["PINECONE_KEY"] # app.pinecone.io
|
7 |
INDEX_ID = 'ask-youtube'
|
8 |
|
9 |
+
def local_css(file_name):
|
10 |
+
st.markdown('<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">', unsafe_allow_html=True)
|
11 |
+
with open(file_name) as f:
|
12 |
+
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
|
13 |
+
|
14 |
+
@st.experimental_singleton
|
15 |
+
def init_template():
|
16 |
+
local_css("style.css")
|
17 |
+
|
18 |
@st.experimental_singleton
|
19 |
def init_pinecone():
|
20 |
pinecone.init(api_key=PINECONE_KEY, environment="us-west1-gcp")
|
|
|
49 |
logging.error(f"Query failed")
|
50 |
return matches
|
51 |
|
52 |
+
init_template()
|
53 |
st.session_state.index = init_pinecone()
|
54 |
retriever = init_retriever()
|
55 |
|