stivenDR14 commited on
Commit
a71c291
·
1 Parent(s): 45ae68c

some adjustments

Browse files
Files changed (2) hide show
  1. pdf_processor.py +1 -1
  2. utils.py +23 -7
pdf_processor.py CHANGED
@@ -146,7 +146,7 @@ class PDFProcessor:
146
 
147
  def process_pdf(self, pdf_file, chunk_size, chunk_overlap, ai_model, type_model, api_key, project_id_watsonx):
148
  defined_chunk_size = 1000
149
- defined_chunk_overlap = 100
150
  if (ai_model == "Open AI / GPT-4o-mini" and (api_key == "")) : #or (ai_model == "IBM Granite3.1 dense / Ollama local" and type_model == "Api Key" and (api_key == "" or project_id_watsonx == "")
151
  return TRANSLATIONS[self.language]["api_key_required"]
152
  if pdf_file is not None:
 
146
 
147
  def process_pdf(self, pdf_file, chunk_size, chunk_overlap, ai_model, type_model, api_key, project_id_watsonx):
148
  defined_chunk_size = 1000
149
+ defined_chunk_overlap = 150
150
  if (ai_model == "Open AI / GPT-4o-mini" and (api_key == "")) : #or (ai_model == "IBM Granite3.1 dense / Ollama local" and type_model == "Api Key" and (api_key == "" or project_id_watsonx == "")
151
  return TRANSLATIONS[self.language]["api_key_required"]
152
  if pdf_file is not None:
utils.py CHANGED
@@ -1,10 +1,26 @@
1
- AI_MODELS = {
2
- "Huggingface / IBM granite granite 3.1 8b Instruct": "ibm-granite/granite-3.1-8b-instruct",
3
- "Huggingface / Mistral Small 24B Instruct": "mistralai/Mistral-Small-24B-Instruct-2501",
4
- "Huggingface / SmolLM2 1.7B Instruct": "HuggingFaceTB/SmolLM2-1.7B-Instruct",
5
- "IBM Granite3.1 dense / Ollama local": "ollama",
6
- "Open AI / GPT-4o-mini": "openai",
7
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  TRANSLATIONS = {
10
  "Español": {
 
1
+
2
+ import os
3
+ from dotenv import load_dotenv
4
+
5
+ load_dotenv()
6
+
7
+ ENVIRONMENT = os.getenv("ENVIRONMENT")
8
+
9
+ if ENVIRONMENT == "dev":
10
+ AI_MODELS = {
11
+ "Huggingface / IBM granite granite 3.1 8b Instruct": "ibm-granite/granite-3.1-8b-instruct",
12
+ "Huggingface / Mistral Small 24B Instruct": "mistralai/Mistral-Small-24B-Instruct-2501",
13
+ "Huggingface / SmolLM2 1.7B Instruct": "HuggingFaceTB/SmolLM2-1.7B-Instruct",
14
+ "IBM Granite3.1 dense / Ollama local": "ollama",
15
+ "Open AI / GPT-4o-mini": "openai",
16
+ }
17
+ else:
18
+ AI_MODELS = {
19
+ "Huggingface / IBM granite granite 3.1 8b Instruct": "ibm-granite/granite-3.1-8b-instruct",
20
+ "Huggingface / Mistral Small 24B Instruct": "mistralai/Mistral-Small-24B-Instruct-2501",
21
+ "Huggingface / SmolLM2 1.7B Instruct": "HuggingFaceTB/SmolLM2-1.7B-Instruct",
22
+ "Open AI / GPT-4o-mini": "openai",
23
+ }
24
 
25
  TRANSLATIONS = {
26
  "Español": {