File size: 439 Bytes
aca2f00
613d903
aca2f00
 
 
 
 
 
613d903
aca2f00
613d903
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import joblib
from typing import List, Dict

# Загрузка модели
model_path = "model/language_classifier.joblib"
model = joblib.load(model_path)

# Функция для предсказания
def predict(texts: List[str]) -> List[Dict[str, float]]:
    predictions = model.predict(texts)
    results = []
    for prediction in predictions:
        results.append({"label": str(prediction), "score": 1.0})
    return results