Skip to content

Commit 4617ae7

Browse files
committed
changed mood
1 parent dca2e4b commit 4617ae7

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

‎index.html‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8-
<title>Document</title>
8+
<title>Mood</title>
99
<script defer src="face-api.min.js"></script>
1010
<script defer src="script.js"></script>
1111
<style>
@@ -19,6 +19,7 @@
1919
align-items: center;
2020
flex-direction: column;
2121
transition: background-color 500ms linear;
22+
font-family: 'Courier New', Courier, monospace;
2223
}
2324

2425
canvas {
@@ -28,10 +29,11 @@
2829
</head>
2930

3031
<body>
31-
<h1 style="position: absolute;top: 40px;">I created this all by myself fixed preload attribute</h1>
32+
<h1 style="position: absolute;top: 40px;">Disclaimer: May cause seizures</h1>
3233
<video id="video" width="720" height="560" preload="auto" autoplay="" muted=""></video>
3334
<h1 id="color"
34-
style="background-color:white; border-radius: 5%; padding: 5px 20px 5px 20px; border: 1px solid black; position: absolute;bottom: 40px;">
35+
style="background-color:white; border-radius: 5%; padding: 5px 40px 5px 40px; border: 1px solid black; position: absolute;bottom: 40px;">
36+
MOOD:
3537
</h1>
3638
</body>
3739

‎script.js‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,37 @@ function setExpression(value) {
4040
return;
4141
}
4242

43-
console.log("value", value);
4443

4544
let { surprised, angry, disgusted, fearful, happy, neutral, sad } =
4645
value && value[0] && value[0].expressions;
4746

47+
console.log(value[0].expressions)
48+
4849
let colorClass = document.getElementById("color");
4950

5051
let color = "white"
52+
let mood = "Neutral"
5153

5254
if (angry > 0.8) {
55+
mood = "Angry"
5356
color = "red";
5457
} else if (disgusted > 0.8) {
58+
mood = "Disgusted"
5559
color = "chartreuse";
5660
} else if (fearful > 0.8) {
61+
mood = "Fearful"
5762
color = "yellow";
5863
} else if (happy > 0.8) {
64+
mood = "Happy"
5965
color = "green";
6066
} else if (neutral > 0.8) {
67+
mood = "Neutral"
6168
color = "black";
6269
} else if (sad > 0.8) {
70+
mood = "Sad"
6371
color = "blue";
6472
} else if (surprised > 0.8) {
73+
mood = "Surprised"
6574
color = "white";
6675
} else {
6776
color = "white";

0 commit comments

Comments
 (0)