Spaces:
Sleeping
Sleeping
Create config_manager.py
Browse files
src/modules/config_manager.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import sys
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
try:
|
| 6 |
+
from utils.reproducibility import set_seed
|
| 7 |
+
except ModuleNotFoundError:
|
| 8 |
+
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
| 9 |
+
from utils.reproducibility import set_seed
|
| 10 |
+
# Establecer una semilla para reproducibilidad (descomenta para activar)
|
| 11 |
+
# set_seed(72)
|
| 12 |
+
|
| 13 |
+
# Clase para gestionar la carga y acceso a la configuraci贸n general del proyecto.
|
| 14 |
+
class ConfigManager:
|
| 15 |
+
def __init__(self, config_path='config/config_modelos.json'):
|
| 16 |
+
with open(config_path, 'r', encoding='utf-8') as f:
|
| 17 |
+
self.config = json.load(f)
|
| 18 |
+
|
| 19 |
+
def get(self, key, default=None):
|
| 20 |
+
return self.config.get(key, default)
|
| 21 |
+
|
| 22 |
+
@property
|
| 23 |
+
def modelo_generador(self):
|
| 24 |
+
return self.config['modelo_generador']
|
| 25 |
+
|
| 26 |
+
@property
|
| 27 |
+
def modelo_a_evaluar(self):
|
| 28 |
+
return self.config['modelo_a_evaluar']
|
| 29 |
+
|
| 30 |
+
@property
|
| 31 |
+
def modelo_analisis_de_sentimiento(self):
|
| 32 |
+
return self.config['modelo_analisis_de_sentimiento']
|