Yoma
commited on
Commit
·
e1e4c9b
1
Parent(s):
37fec54
Updated to handle HF secrets
Browse files
config.py
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
# config.py
|
| 2 |
-
# This file will store configuration variables, including API keys and prompt constants.
|
| 3 |
-
|
| 4 |
import os
|
| 5 |
-
from dotenv import load_dotenv
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
#
|
| 11 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 12 |
-
|
| 13 |
-
# TMDB API Key (loaded from .env file)
|
| 14 |
TMDB_API_KEY = os.getenv("TMDB_API_KEY")
|
| 15 |
|
| 16 |
# LLM Model Name (as specified on Hugging Face)
|
| 17 |
LLM_MODEL_NAME = "huggingface/meta-llama/Llama-3.2-3B-Instruct"
|
| 18 |
-
#LLM_MODEL_NAME = "ollama/llama3.2"
|
| 19 |
|
| 20 |
# Base prompt for LLM explanations
|
| 21 |
BASE_PROMPT = """
|
|
@@ -25,4 +25,4 @@ Max 60 words. Be punchy. Do not start with 'Based on your history'.
|
|
| 25 |
|
| 26 |
# Injections for narrative styles
|
| 27 |
LOGIC_INJECTION = "Focus on technical alignment and genre overlap."
|
| 28 |
-
SOCIAL_INJECTION = "Focus on community acclaim and fan-favorite status."
|
|
|
|
| 1 |
# config.py
|
|
|
|
|
|
|
| 2 |
import os
|
|
|
|
| 3 |
|
| 4 |
+
# Try to load local .env file if it exists (for local development)
|
| 5 |
+
try:
|
| 6 |
+
from dotenv import load_dotenv
|
| 7 |
+
load_dotenv()
|
| 8 |
+
except ImportError:
|
| 9 |
+
# python-dotenv not installed, which is fine on HF Spaces
|
| 10 |
+
# as secrets are handled by the OS environment
|
| 11 |
+
pass
|
| 12 |
|
| 13 |
+
# API Keys (loaded from Secrets on HF Spaces or .env locally)
|
| 14 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
|
|
|
|
|
|
| 15 |
TMDB_API_KEY = os.getenv("TMDB_API_KEY")
|
| 16 |
|
| 17 |
# LLM Model Name (as specified on Hugging Face)
|
| 18 |
LLM_MODEL_NAME = "huggingface/meta-llama/Llama-3.2-3B-Instruct"
|
|
|
|
| 19 |
|
| 20 |
# Base prompt for LLM explanations
|
| 21 |
BASE_PROMPT = """
|
|
|
|
| 25 |
|
| 26 |
# Injections for narrative styles
|
| 27 |
LOGIC_INJECTION = "Focus on technical alignment and genre overlap."
|
| 28 |
+
SOCIAL_INJECTION = "Focus on community acclaim and fan-favorite status."
|