File size: 368 Bytes
1f3e8b1
 
 
 
70a269f
1f3e8b1
 
 
70a269f
1f3e8b1
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr
from transformers import pipeline

APP_NAME = "MoodMapper"
MODEL_ID = "j-hartmann/emotion-english-distilroberta-base"

_clf = None
def get_clf():
    """Charge le modèle une seule fois pour éviter les ralentissements."""
    global _clf
    if _clf is None:
        _clf = pipeline(
            "text-classification",
            model=MODEL_ID,