kajila commited on
Commit
d7862ee
·
verified ·
1 Parent(s): b3e27ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -33,8 +33,18 @@ openai.api_key = os.getenv("OPENAI_API_KEY") # Ensure OPENAI_API_KEY is in your
33
  # raise ValueError("Hugging Face token is missing. Please check your .env file.")
34
 
35
  # Log in to Hugging Face
 
 
 
 
 
 
 
 
36
  login(hf_token)
37
 
 
 
38
  # Set up embeddings and vector store
39
  embeddings = SentenceTransformerEmbeddings(model_name="thenlper/gte-large")
40
  collection_name = 'report-10k-2024'
 
33
  # raise ValueError("Hugging Face token is missing. Please check your .env file.")
34
 
35
  # Log in to Hugging Face
36
+ # Retrieve the Hugging Face token from environment variables
37
+ hf_token = os.getenv("hf_token")
38
+
39
+ # Check if the token is retrieved successfully
40
+ if not hf_token:
41
+ raise ValueError("Hugging Face token is missing. Please set 'hf_token' as an environment variable.")
42
+
43
+ # Log in to Hugging Face with the retrieved token
44
  login(hf_token)
45
 
46
+ print("Logged in to Hugging Face successfully.")
47
+
48
  # Set up embeddings and vector store
49
  embeddings = SentenceTransformerEmbeddings(model_name="thenlper/gte-large")
50
  collection_name = 'report-10k-2024'