Spaces:
Running
Running
File size: 873 Bytes
22379c6 150c3f8 22379c6 150c3f8 22379c6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
import os
import pathlib
from functools import lru_cache
from dotenv import load_dotenv
from flair.models import SequenceTagger
load_dotenv()
class BaseConfig:
BASE_DIR: pathlib.Path = pathlib.Path(__file__).parent.parent.parent
SECRET_KEY = os.getenv('SECRET')
TAGGER = SequenceTagger.load("flair/ner-english-large")
class DevelopmentConfig(BaseConfig):
Issuer = "http://localhost:8000"
Audience = "http://localhost:3000"
class ProductionConfig(BaseConfig):
Issuer = ""
Audience = ""
@lru_cache()
def get_settings() -> DevelopmentConfig | ProductionConfig:
config_cls_dict = {
'development': DevelopmentConfig,
'production': ProductionConfig,
}
config_name = os.getenv('FASTAPI_CONFIG', default='development')
config_cls = config_cls_dict[config_name]
return config_cls()
settings = get_settings()
|