Update backend/utils/last_activity.py
Browse files
backend/utils/last_activity.py
CHANGED
@@ -7,6 +7,8 @@ from typing import Dict, Any, List, Tuple
|
|
7 |
from huggingface_hub import HfApi
|
8 |
from dotenv import load_dotenv
|
9 |
|
|
|
|
|
10 |
# Get the backend directory path
|
11 |
BACKEND_DIR = Path(__file__).parent.parent
|
12 |
ROOT_DIR = BACKEND_DIR.parent
|
@@ -22,13 +24,13 @@ logging.basicConfig(
|
|
22 |
logger = logging.getLogger(__name__)
|
23 |
|
24 |
# Initialize Hugging Face API
|
25 |
-
HF_TOKEN = os.getenv("HF_TOKEN")
|
26 |
-
if not HF_TOKEN:
|
27 |
-
raise ValueError("HF_TOKEN not found in environment variables")
|
28 |
api = HfApi(token=HF_TOKEN)
|
29 |
|
30 |
# Default organization
|
31 |
-
HF_ORGANIZATION = os.getenv('HF_ORGANIZATION', 'TheFinAI')
|
32 |
|
33 |
def get_last_votes(limit: int = 5) -> List[Dict]:
|
34 |
"""Get the last votes from the votes dataset"""
|
|
|
7 |
from huggingface_hub import HfApi
|
8 |
from dotenv import load_dotenv
|
9 |
|
10 |
+
from app.config.hf_config import HF_TOKEN, HF_ORGANIZATION, HF_AGGREGATED
|
11 |
+
|
12 |
# Get the backend directory path
|
13 |
BACKEND_DIR = Path(__file__).parent.parent
|
14 |
ROOT_DIR = BACKEND_DIR.parent
|
|
|
24 |
logger = logging.getLogger(__name__)
|
25 |
|
26 |
# Initialize Hugging Face API
|
27 |
+
# HF_TOKEN = os.getenv("HF_TOKEN")
|
28 |
+
# if not HF_TOKEN:
|
29 |
+
# raise ValueError("HF_TOKEN not found in environment variables")
|
30 |
api = HfApi(token=HF_TOKEN)
|
31 |
|
32 |
# Default organization
|
33 |
+
# HF_ORGANIZATION = os.getenv('HF_ORGANIZATION', 'TheFinAI')
|
34 |
|
35 |
def get_last_votes(limit: int = 5) -> List[Dict]:
|
36 |
"""Get the last votes from the votes dataset"""
|