vhr1007 commited on
Commit
f8872d2
1 Parent(s): 6682130

changes revert

Browse files
.gitignore CHANGED
@@ -1,2 +1,2 @@
1
  .env
2
- .env
 
1
  .env
2
+
__pycache__/app.cpython-311.pyc ADDED
Binary file (6.08 kB). View file
 
app.py CHANGED
@@ -12,22 +12,9 @@ import logging
12
  import time
13
  import os
14
  from dotenv import load_dotenv
15
- from huggingface_hub import HfApi, HfFolder
16
 
17
  #load_dotenv()
18
 
19
- # Set the HF_HOME directory programmatically to a writable directory
20
- os.environ["HF_HOME"] = "/app/.cache/huggingface"
21
- os.makedirs(os.environ["HF_HOME"], exist_ok=True)
22
-
23
- # Initialize Hugging Face API
24
- huggingface_token = os.getenv("HUGGINGFACE_HUB_TOKEN")
25
- if huggingface_token:
26
- HfFolder.save_token(huggingface_token)
27
- else:
28
- raise ValueError("Hugging Face token is not set. Please set the HUGGINGFACE_HUB_TOKEN environment variable.")
29
-
30
-
31
  # Retrieve the API key from the environment
32
  API_KEY = os.getenv('X_API_KEY')
33
  bucket_name = os.getenv('bucket_name')
 
12
  import time
13
  import os
14
  from dotenv import load_dotenv
 
15
 
16
  #load_dotenv()
17
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  # Retrieve the API key from the environment
19
  API_KEY = os.getenv('X_API_KEY')
20
  bucket_name = os.getenv('bucket_name')
utils/__init__.py ADDED
File without changes
utils/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (166 Bytes). View file
 
utils/__pycache__/embedding_utils.cpython-311.pyc ADDED
Binary file (8.16 kB). View file
 
utils/__pycache__/qdrant_utils.cpython-311.pyc ADDED
Binary file (3.67 kB). View file
 
utils/__pycache__/s3_utils.cpython-311.pyc ADDED
Binary file (3.74 kB). View file
 
utils/embedding_utils.py CHANGED
@@ -2,7 +2,7 @@
2
 
3
  from sentence_transformers import SentenceTransformer
4
  from llama_index.core import SimpleDirectoryReader
5
-
6
  from typing import List, Tuple
7
  from dotenv import load_dotenv
8
  import numpy as np
@@ -12,7 +12,7 @@ from docx import Document
12
  import tempfile
13
  import os
14
  import logging
15
- from huggingface_hub import HfFolder
16
 
17
  # Load environment variables from .env file
18
  #load_dotenv()
@@ -20,9 +20,9 @@ from huggingface_hub import HfFolder
20
  # Load Hugging Face token from environment variable
21
  huggingface_token = os.getenv('HUGGINGFACE_HUB_TOKEN')
22
 
23
- # Save the Hugging Face token securely
24
  if huggingface_token:
25
- HfFolder.save_token(huggingface_token)
26
  else:
27
  raise ValueError("Hugging Face token is not set. Please set the HUGGINGFACE_HUB_TOKEN environment variable.")
28
 
 
2
 
3
  from sentence_transformers import SentenceTransformer
4
  from llama_index.core import SimpleDirectoryReader
5
+ from huggingface_hub import login
6
  from typing import List, Tuple
7
  from dotenv import load_dotenv
8
  import numpy as np
 
12
  import tempfile
13
  import os
14
  import logging
15
+
16
 
17
  # Load environment variables from .env file
18
  #load_dotenv()
 
20
  # Load Hugging Face token from environment variable
21
  huggingface_token = os.getenv('HUGGINGFACE_HUB_TOKEN')
22
 
23
+
24
  if huggingface_token:
25
+ login(token=huggingface_token, add_to_git_credential=True)
26
  else:
27
  raise ValueError("Hugging Face token is not set. Please set the HUGGINGFACE_HUB_TOKEN environment variable.")
28