Spaces:
Sleeping
Sleeping
Download src/utils/emotionUtils.js from Aya07/emotion-ui: direct link, hf CLI and curl.
- Browser
- Download file 822 Bytes
-
https://huggingface.co/spaces/Aya07/emotion-ui/resolve/main/src/utils/emotionUtils.js
- Command line
-
hf download hf://spaces/Aya07/emotion-ui/src/utils/emotionUtils.js
-
curl -L -o emotionUtils.js https://huggingface.co/spaces/Aya07/emotion-ui/resolve/main/src/utils/emotionUtils.js
822 Bytes
| import { emotionNames } from "../constants/translations"; | |
| export const getEmotionColor = (emotion) => { | |
| const colors = { | |
| happy: "#58002C", | |
| sad: "#AC1634", | |
| angry: "#7A0028", | |
| neutral: "#E77291", | |
| fearful: "#D4A5A5", | |
| disgust: "#7C9F6E", | |
| surprised: "#FFC4A4", | |
| }; | |
| return colors[emotion?.toLowerCase()] || "#FFB7C5"; | |
| }; | |
| export const translateEmotion = (lang, name) => | |
| emotionNames[lang]?.[name] || name; | |
| export const getEmotionIcon = (prediction) => { | |
| const icons = { | |
| Happy: "π", | |
| Angry: "π ", | |
| Sad: "π’", | |
| Neutral: "π", | |
| }; | |
| return icons[prediction] || "π"; | |
| }; | |
| export const formatTime = (seconds) => { | |
| const mins = Math.floor(seconds / 60); | |
| const secs = seconds % 60; | |
| return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`; | |
| }; |