ProfessorLeVesseur commited on
Commit
1f1be9c
·
verified ·
1 Parent(s): 7639be6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -35
app.py CHANGED
@@ -6,48 +6,25 @@ import random
6
 
7
 
8
 
9
- # # Fetch the OpenAI API key from Streamlit secrets
10
- # openai_api_key = st.secrets["openai_api_key"]
11
-
12
- # # Initialize the OpenAI service with API key
13
- # openai.api_key = openai_api_key
14
-
15
- # # # Fetch Pinecone API key and environment from Streamlit secrets
16
- # # PINECONE_API_KEY = st.secrets["PINECONE_API_KEY"]
17
- # # # pinecone_api_key = '555c0e70-331d-4b43-aac7-5b3aac5078d6'
18
- # # pinecone_environment = st.secrets["pinecone_environment"]
19
-
20
- # # # AUTHENTICATE/INITIALIZE PINCONE SERVICE
21
- # from pinecone import Pinecone
22
- # # # pc = Pinecone(api_key=PINECONE_API_KEY)
23
- # # pc = Pinecone (api_key= 'YOUR_API_KEY')
24
-
25
- # PINECONE_API_KEY = "555c0e70-331d-4b43-aac7-5b3aac5078d6"
26
- # pc = Pinecone(api_key=PINECONE_API_KEY)
27
 
28
-
29
-
30
- import os
31
- # from pathlib import Path
32
- # Import specific functions from python-dotenv package (i.e., used to read key-value pairs from a .env file and add them to the environment variables.)
33
- from dotenv import load_dotenv, find_dotenv
34
- # Find and load .env file, override existing environment variables
35
- load_dotenv(find_dotenv(), override=True)
36
-
37
- # Retrieve OpenAI API key from environment variables
38
- openai_api_key = os.getenv('OPENAI_API_KEY')
39
- if not openai_api_key:
40
- raise ValueError("OPENAI_API_KEY not set in environment variables")
41
  # Initialize the OpenAI service with API key
42
  openai.api_key = openai_api_key
43
 
44
- # Hardcode the OpenAI API key
45
- # openai_api_key = "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"
 
 
46
 
47
- # AUTHENTICATE/INITIALIZE PINCONE SERVICE
48
  from pinecone import Pinecone
49
- pc = Pinecone()
 
50
 
 
 
51
 
52
 
53
 
 
6
 
7
 
8
 
9
+ # Fetch the OpenAI API key from Streamlit secrets
10
+ openai_api_key = st.secrets["openai_api_key"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ openai_api_key = "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"
 
 
 
 
 
 
 
 
 
 
 
 
13
  # Initialize the OpenAI service with API key
14
  openai.api_key = openai_api_key
15
 
16
+ # # Fetch Pinecone API key and environment from Streamlit secrets
17
+ # PINECONE_API_KEY = st.secrets["PINECONE_API_KEY"]
18
+ # # pinecone_api_key = '555c0e70-331d-4b43-aac7-5b3aac5078d6'
19
+ # pinecone_environment = st.secrets["pinecone_environment"]
20
 
21
+ # # AUTHENTICATE/INITIALIZE PINCONE SERVICE
22
  from pinecone import Pinecone
23
+ # # pc = Pinecone(api_key=PINECONE_API_KEY)
24
+ # pc = Pinecone (api_key= 'YOUR_API_KEY')
25
 
26
+ PINECONE_API_KEY = "555c0e70-331d-4b43-aac7-5b3aac5078d6"
27
+ pc = Pinecone(api_key=PINECONE_API_KEY)
28
 
29
 
30