shrut123 commited on
Commit
d792c52
1 Parent(s): b21411e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -6,6 +6,9 @@ from sentence_transformers import SentenceTransformer
6
  # Title of the Streamlit App
7
  st.title("Pinecone Index Management with Streamlit")
8
 
 
 
 
9
  # Function to initialize Pinecone
10
  def initialize_pinecone():
11
  api_key = os.getenv('PINECONE_API_KEY') # Get Pinecone API key from environment variable
@@ -48,6 +51,7 @@ if pc:
48
 
49
  # Button to create or connect to index
50
  if st.button("Create or Connect to Index"):
 
51
  index = create_or_connect_index(pc, index_name, dimension)
52
  if index:
53
  st.success(f"Successfully connected to index '{index_name}'")
 
6
  # Title of the Streamlit App
7
  st.title("Pinecone Index Management with Streamlit")
8
 
9
+ # Initialize Pinecone globally
10
+ index = None
11
+
12
  # Function to initialize Pinecone
13
  def initialize_pinecone():
14
  api_key = os.getenv('PINECONE_API_KEY') # Get Pinecone API key from environment variable
 
51
 
52
  # Button to create or connect to index
53
  if st.button("Create or Connect to Index"):
54
+ global index # Make index a global variable
55
  index = create_or_connect_index(pc, index_name, dimension)
56
  if index:
57
  st.success(f"Successfully connected to index '{index_name}'")