diff options
author | Tekky <98614666+xtekky@users.noreply.github.com> | 2024-06-05 14:13:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-05 14:13:57 +0200 |
commit | 87a96ce0d772bd589a73169a244532b03cad5be7 (patch) | |
tree | b552b0c838c286e0cb87969a99bcb9516df34038 /g4f/locals/models.py | |
parent | remove ecosia (diff) | |
parent | Update models.py to create models directory when its not present (diff) | |
download | gpt4free-87a96ce0d772bd589a73169a244532b03cad5be7.tar gpt4free-87a96ce0d772bd589a73169a244532b03cad5be7.tar.gz gpt4free-87a96ce0d772bd589a73169a244532b03cad5be7.tar.bz2 gpt4free-87a96ce0d772bd589a73169a244532b03cad5be7.tar.lz gpt4free-87a96ce0d772bd589a73169a244532b03cad5be7.tar.xz gpt4free-87a96ce0d772bd589a73169a244532b03cad5be7.tar.zst gpt4free-87a96ce0d772bd589a73169a244532b03cad5be7.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/locals/models.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/g4f/locals/models.py b/g4f/locals/models.py index f82f5448..8e1c06bf 100644 --- a/g4f/locals/models.py +++ b/g4f/locals/models.py @@ -37,8 +37,10 @@ def get_model_dir() -> str: local_dir = os.path.dirname(os.path.abspath(__file__)) project_dir = os.path.dirname(os.path.dirname(local_dir)) model_dir = os.path.join(project_dir, "models") - if os.path.exists(model_dir): - return model_dir + if not os.path.exists(model_dir): + os.mkdir(model_dir) + return model_dir + def get_models() -> dict[str, dict]: model_dir = get_model_dir() @@ -48,4 +50,4 @@ def get_models() -> dict[str, dict]: else: models = load_models() save_models(file_path, models) - return models
\ No newline at end of file + return models |