vincentamato commited on
Commit
c030074
·
1 Parent(s): 8629f1c

Fixed chart rendering

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -3,6 +3,8 @@ import sys
3
  import gradio as gr
4
  import torch
5
  import numpy as np
 
 
6
  import matplotlib.pyplot as plt
7
  from PIL import Image
8
  from huggingface_hub import hf_hub_download
@@ -66,8 +68,6 @@ models = {}
66
  def create_emotion_plot(valence, arousal):
67
  """Create a valence-arousal plot with the predicted emotion point"""
68
  # Create figure in a process-safe way
69
- plt.switch_backend('Agg')
70
-
71
  fig = plt.figure(figsize=(8, 8), dpi=100)
72
  ax = fig.add_subplot(111)
73
 
 
3
  import gradio as gr
4
  import torch
5
  import numpy as np
6
+ import matplotlib
7
+ matplotlib.use('Agg') # Set backend before importing pyplot
8
  import matplotlib.pyplot as plt
9
  from PIL import Image
10
  from huggingface_hub import hf_hub_download
 
68
  def create_emotion_plot(valence, arousal):
69
  """Create a valence-arousal plot with the predicted emotion point"""
70
  # Create figure in a process-safe way
 
 
71
  fig = plt.figure(figsize=(8, 8), dpi=100)
72
  ax = fig.add_subplot(111)
73