Spaces:
Building
Building
Update app.py
Browse files
app.py
CHANGED
@@ -2,12 +2,10 @@ from fastapi import FastAPI
|
|
2 |
from controllers import chat_controller, test_controller, admin_controller, health_controller
|
3 |
from core import service_config, session_store, llm_models
|
4 |
from llm_model import LLMModel
|
5 |
-
from intent_utils import background_training
|
6 |
from log import log
|
7 |
import os
|
8 |
import warnings
|
9 |
|
10 |
-
# FutureWarning'leri sustur
|
11 |
warnings.simplefilter(action='ignore', category=FutureWarning)
|
12 |
|
13 |
app = FastAPI()
|
@@ -24,27 +22,7 @@ def load_project(project_name, config, project_path):
|
|
24 |
model_instance = LLMModel()
|
25 |
model_instance.setup(config, llm_config, project_path)
|
26 |
|
27 |
-
# Intent modeli
|
28 |
-
intent_model_path = os.path.join(project_path, "intent", "trained_model")
|
29 |
-
|
30 |
-
# Eğer intent modeli klasörü yoksa → eğitim başlat
|
31 |
-
if not os.path.exists(intent_model_path) or not os.path.isfile(os.path.join(intent_model_path, "config.json")):
|
32 |
-
log(f"🛠 Intent modeli bulunamadı, eğitim başlatılıyor: {intent_model_path}")
|
33 |
-
intents = config.get_project_intents(project_name)
|
34 |
-
os.makedirs(intent_model_path, exist_ok=True)
|
35 |
-
background_training(
|
36 |
-
project_name,
|
37 |
-
intents,
|
38 |
-
llm_config["intent_model_id"],
|
39 |
-
intent_model_path,
|
40 |
-
llm_config["train_confidence_treshold"]
|
41 |
-
)
|
42 |
-
|
43 |
-
# Eğitim sonrası intent modelini yükle
|
44 |
-
if os.path.exists(intent_model_path) and os.path.isfile(os.path.join(intent_model_path, "config.json")):
|
45 |
-
model_instance.load_intent_model(intent_model_path)
|
46 |
-
else:
|
47 |
-
log(f"⚠️ Intent modeli yüklenemedi: {intent_model_path}, yükleme atlandı.")
|
48 |
|
49 |
return model_instance
|
50 |
|
@@ -56,7 +34,6 @@ for project_name in service_config.projects:
|
|
56 |
os.makedirs(project_path, exist_ok=True)
|
57 |
os.makedirs(os.path.join(project_path, "llm", "base_model"), exist_ok=True)
|
58 |
os.makedirs(os.path.join(project_path, "llm", "fine_tune"), exist_ok=True)
|
59 |
-
os.makedirs(os.path.join(project_path, "intent", "trained_model"), exist_ok=True)
|
60 |
|
61 |
model_instance = load_project(project_name, service_config, project_path)
|
62 |
llm_models[project_name] = model_instance
|
|
|
2 |
from controllers import chat_controller, test_controller, admin_controller, health_controller
|
3 |
from core import service_config, session_store, llm_models
|
4 |
from llm_model import LLMModel
|
|
|
5 |
from log import log
|
6 |
import os
|
7 |
import warnings
|
8 |
|
|
|
9 |
warnings.simplefilter(action='ignore', category=FutureWarning)
|
10 |
|
11 |
app = FastAPI()
|
|
|
22 |
model_instance = LLMModel()
|
23 |
model_instance.setup(config, llm_config, project_path)
|
24 |
|
25 |
+
# ❌ Intent modeli artık kullanılmıyor → bu blok kaldırıldı
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
return model_instance
|
28 |
|
|
|
34 |
os.makedirs(project_path, exist_ok=True)
|
35 |
os.makedirs(os.path.join(project_path, "llm", "base_model"), exist_ok=True)
|
36 |
os.makedirs(os.path.join(project_path, "llm", "fine_tune"), exist_ok=True)
|
|
|
37 |
|
38 |
model_instance = load_project(project_name, service_config, project_path)
|
39 |
llm_models[project_name] = model_instance
|