Spaces:
Runtime error
Runtime error
Commit History
-
Update requirements.txt
Verified signature51e32cc -
Create app.py
Verified signature1f3e8b1 -
Update requirements.txt
Verified signaturebd5a627 -
Delete app.py
Verified signatureimport gradio as gr from transformers import pipeline APP_NAME = "MoodMapper" MODEL_ID = "j-hartmann/emotion-english-distilroberta-base" # garde celui-ci pour l’instant _clf = None def get_clf(): global _clf if _clf is None: _clf = pipeline( "text-classification", model=MODEL_ID, return_all_scores=True, truncation=True ) return _clf EXAMPLES = [ "I just got the internship — I'm so happy!", "Je suis déçue et un peu en colère par ce mail.", "This is fine, nothing special today.", "I'm worried about the deadline...", "Quelle surprise ! Je ne m’y attendais pas." ] def predict_emotion(text): try: if not text or not text.strip(): return {"": 0.0}, "Veuillez entrer un texte." scores = get_clf()(text)[0] # [{'label': 'joy', 'score': 0.97}, ...] score_dict = {s["label"]: float(s["score"]) for s in scores} top = max(scores, key=lambda d: d["score"]…a533758 -
Create requirements.txt
Verified signature74f9c27 -
Create app.py
Verified signature4096b10 -
initial commit
Verified signature2832a32