Luigi commited on
Commit
e5da3db
·
1 Parent(s): cd71716

bugfix to display error

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -102,7 +102,10 @@ def classify_video(video_path):
102
  buf.seek(0)
103
  plt.close(fig)
104
 
105
- return results_text, buf
 
 
 
106
 
107
  def process_video(video_file):
108
  if video_file is None:
@@ -121,8 +124,8 @@ demo = gr.Interface(
121
  title="Video Human Detection Demo using TimeSformer",
122
  description=(
123
  "Upload a video clip to see the top predicted human action labels using the TimeSformer model "
124
- "(fine-tuned on Kinetics-400). The output shows each prediction along with its class ID and probability, "
125
- "and a bar chart displays the distribution of the top 5 predictions."
126
  )
127
  )
128
 
 
102
  buf.seek(0)
103
  plt.close(fig)
104
 
105
+ # Convert the BytesIO plot to a PIL Image.
106
+ chart_image = Image.open(buf)
107
+
108
+ return results_text, chart_image
109
 
110
  def process_video(video_file):
111
  if video_file is None:
 
124
  title="Video Human Detection Demo using TimeSformer",
125
  description=(
126
  "Upload a video clip to see the top predicted human action labels using the TimeSformer model "
127
+ "(fine-tuned on Kinetics-400). The output shows each prediction (with class ID and label) and a bar chart "
128
+ "of the distribution over the top 5 predictions."
129
  )
130
  )
131