tori29umai commited on
Commit
4e9e6ca
1 Parent(s): d592e16

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -6
app.py CHANGED
@@ -19,12 +19,21 @@ DEFAULT_INI_FILE = 'settings.ini'
19
  MODEL_FILE_EXTENSION = '.gguf'
20
 
21
  # パスの設定
22
- if getattr(sys, 'frozen', False):
23
- BASE_PATH = os.path.dirname(sys.executable)
24
- MODEL_DIR = os.path.join(os.path.dirname(BASE_PATH), "AINovelChat", "models")
25
- else:
26
- BASE_PATH = os.path.dirname(os.path.abspath(__file__))
27
- MODEL_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "models")
 
 
 
 
 
 
 
 
 
28
 
29
  class ConfigManager:
30
  @staticmethod
 
19
  MODEL_FILE_EXTENSION = '.gguf'
20
 
21
  # パスの設定
22
+ BASE_PATH = os.path.dirname(os.path.abspath(__file__))
23
+ MODEL_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "models")
24
+
25
+
26
+ # モデルディレクトリが存在しない場合は作成
27
+ if not os.path.exists("models"):
28
+ os.makedirs("models")
29
+
30
+ # 使用するモデルのファイル名を指定
31
+ model_filename = "EZO-Common-9B-gemma-2-it.f16.gguf"
32
+ model_path = os.path.join("models", model_filename)
33
+
34
+ # モデルファイルが存在しない場合はダウンロード
35
+ if not os.path.exists(model_path):
36
+ dl_guff_model("models", f"https://huggingface.co/MCZK/EZO-Common-9B-gemma-2-it-GGUF/resolve/main/{model_filename}")
37
 
38
  class ConfigManager:
39
  @staticmethod