File size: 266 Bytes
2bbbb9f
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
from transformers import pipeline
from app.core.config import settings

# Initialize the NLP model pipeline
pipe = pipeline("text-classification", model=settings.MODEL_NAME)

def classify_text(text: str) -> str:
    result = pipe(text)[0]
    return result["label"]