CoolFace
Apppublic

Masterdqqq/Facial_Expression_Recognition

sourceHugging Facemitupdated 2y agoView on Hugging Face
1likes
plot.py30 linesDownload Raw Back to app
1"""2File: config.py3Author: Elena Ryumina and Dmitry Ryumin4Description: Plotting statistical information.5License: MIT License6"""7import matplotlib.pyplot as plt8import numpy as np 9 10# Importing necessary components for the Gradio app11from app.config import DICT_EMO, COLORS12 13 14def statistics_plot(frames, probs):15    fig, ax = plt.subplots(figsize=(10, 4))16    fig.subplots_adjust(left=0.07, bottom=0.14, right=0.98, top=0.8, wspace=0, hspace=0)17    # Установка параметров left, bottom, right, top, чтобы выделить место для легенды и названий осей18    probs = np.array(probs)19    for i in range(7):20        try:21            ax.plot(frames, probs[:, i], label=DICT_EMO[i], c=COLORS[i]) 22        except Exception:23            return None24            25    ax.legend(loc='upper center', bbox_to_anchor=(0.47, 1.2), ncol=7, fontsize=12) 26    ax.set_xlabel('Frames', fontsize=12)  # Добавляем подпись к оси X27    ax.set_ylabel('Probability', fontsize=12)  # Добавляем подпись к оси Y28    ax.grid(True)29    return plt30