Spaces:
Running
on
Zero
Running
on
Zero
updated utils
Browse files- utils/utils.py +2 -6
utils/utils.py
CHANGED
@@ -2,18 +2,14 @@ import matplotlib.pyplot as plt
|
|
2 |
import numpy as np
|
3 |
from utils.Caption import get_caption
|
4 |
from utils.Emotions import get_emotions
|
5 |
-
import spaces
|
6 |
|
7 |
-
|
8 |
-
@spaces.GPU
|
9 |
def get_label(image):
|
10 |
caption = get_caption(image)
|
11 |
|
12 |
-
|
13 |
|
14 |
emotions = ['Excitement', 'Sadness', 'Amusement', 'Disgust', 'Awe', 'Contentment', 'Fear', 'Anger']
|
15 |
-
|
16 |
-
probabilities = [10, 6, 8, 1, 5, 10, 6, 8]
|
17 |
max_idx = np.argmax(probabilities)
|
18 |
|
19 |
# Create color list where all bars are one color, and the max bar is another color
|
|
|
2 |
import numpy as np
|
3 |
from utils.Caption import get_caption
|
4 |
from utils.Emotions import get_emotions
|
|
|
5 |
|
|
|
|
|
6 |
def get_label(image):
|
7 |
caption = get_caption(image)
|
8 |
|
9 |
+
pred = get_emotions(image, caption)
|
10 |
|
11 |
emotions = ['Excitement', 'Sadness', 'Amusement', 'Disgust', 'Awe', 'Contentment', 'Fear', 'Anger']
|
12 |
+
probabilities = pred
|
|
|
13 |
max_idx = np.argmax(probabilities)
|
14 |
|
15 |
# Create color list where all bars are one color, and the max bar is another color
|