Spaces:
Build error
Build error
Commit ·
915d33b
1
Parent(s): 810c4b7
111
Browse files- model/plot.py +23 -0
model/plot.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import matplotlib.pyplot as plt
|
| 2 |
+
import numpy as np
|
| 3 |
+
|
| 4 |
+
# Importing necessary components for the Gradio app
|
| 5 |
+
from app.config import DICT_EMO, COLORS
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def statistics_plot(frames, probs):
|
| 9 |
+
fig, ax = plt.subplots(figsize=(10, 4))
|
| 10 |
+
fig.subplots_adjust(left=0.07, bottom=0.14, right=0.98, top=0.8, wspace=0, hspace=0)
|
| 11 |
+
# Установка параметров left, bottom, right, top, чтобы выделить место для легенды и названий осей
|
| 12 |
+
probs = np.array(probs)
|
| 13 |
+
for i in range(7):
|
| 14 |
+
try:
|
| 15 |
+
ax.plot(frames, probs[:, i], label=DICT_EMO[i], c=COLORS[i])
|
| 16 |
+
except Exception:
|
| 17 |
+
return None
|
| 18 |
+
|
| 19 |
+
ax.legend(loc='upper center', bbox_to_anchor=(0.47, 1.2), ncol=7, fontsize=12)
|
| 20 |
+
ax.set_xlabel('Frames', fontsize=12) # Добавляем подпись к оси X
|
| 21 |
+
ax.set_ylabel('Probability', fontsize=12) # Добавляем подпись к оси Y
|
| 22 |
+
ax.grid(True)
|
| 23 |
+
return plt
|