Vivek0912 commited on
Commit
d9d8b61
·
1 Parent(s): 5b95557

updated env variable and secret

Browse files
backend/app/services/gemeni_classification.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import google.generativeai as genai
2
  import json
3
  import email
@@ -7,7 +8,7 @@ import docx
7
  import mimetypes
8
 
9
 
10
- genai.configure(api_key="AIzaSyBdZsC0DG4OYjitl-OmFHLVqYOrBSFkV-c")
11
 
12
  # model = genai.GenerativeModel('gemini-pro')
13
  model = genai.GenerativeModel("gemini-2.0-flash-lite")
 
1
+ from backend.config.settings import Settings
2
  import google.generativeai as genai
3
  import json
4
  import email
 
8
  import mimetypes
9
 
10
 
11
+ genai.configure(api_key=Settings.GEMENI_API_KEY_TOKEN)
12
 
13
  # model = genai.GenerativeModel('gemini-pro')
14
  model = genai.GenerativeModel("gemini-2.0-flash-lite")
backend/config/settings.py CHANGED
@@ -6,24 +6,18 @@ load_dotenv()
6
 
7
 
8
  class Settings:
9
- ENV = os.getenv("ENV", "local") # Default to "local" if ENV is not set
10
  # API Token
11
  HUGGINGFACE_API_TOKEN = os.getenv("HUGGINGFACE_API_TOKEN") or os.environ.get("HUGGINGFACE_API_TOKEN")
 
 
 
12
 
13
  # Model Path
14
  MODEL_NAME = os.getenv("MODEL_NAME") or os.environ.get("MODEL_NAME") # Default if not set
15
  OCR_LANGUAGE = os.getenv("OCR_LANGUAGE", "eng")
16
  directory_path = os.getenv("EMAIL_DIRECTORY_PATH") or os.environ.get("EMAIL_DIRECTORY_PATH") # Make configurable
17
- #MODEL_NAME = "meta-llama/Llama-2-7b"
18
-
19
- # Ensure model path exists
20
- # if not os.path.exists(MODEL_PATH):
21
- # os.makedirs(MODEL_PATH, exist_ok=True)
22
-
23
- # # Validate required variables
24
- # if not HUGGINGFACE_API_TOKEN:
25
- # raise ValueError("Missing HUGGINGFACE_API_TOKEN. Please set it in the environment variables or .env file.")
26
-
27
  # Debugging info
28
  print(f"Running in {ENV} mode with model path: {MODEL_NAME}")
29
  print(f"Running in {ENV} mode with TOKEN: {HUGGINGFACE_API_TOKEN}")
 
6
 
7
 
8
  class Settings:
9
+ ENV = os.getenv("ENV") # Default to "local" if ENV is not set
10
  # API Token
11
  HUGGINGFACE_API_TOKEN = os.getenv("HUGGINGFACE_API_TOKEN") or os.environ.get("HUGGINGFACE_API_TOKEN")
12
+
13
+ GEMENI_API_KEY_TOKEN = os.getenv("GEMENI_API_KEY") or os.environ.get("GEMENI_API_KEY")
14
+
15
 
16
  # Model Path
17
  MODEL_NAME = os.getenv("MODEL_NAME") or os.environ.get("MODEL_NAME") # Default if not set
18
  OCR_LANGUAGE = os.getenv("OCR_LANGUAGE", "eng")
19
  directory_path = os.getenv("EMAIL_DIRECTORY_PATH") or os.environ.get("EMAIL_DIRECTORY_PATH") # Make configurable
20
+
 
 
 
 
 
 
 
 
 
21
  # Debugging info
22
  print(f"Running in {ENV} mode with model path: {MODEL_NAME}")
23
  print(f"Running in {ENV} mode with TOKEN: {HUGGINGFACE_API_TOKEN}")