Thomas Chaigneau commited on
Commit
7a6fb20
1 Parent(s): 2fb5d8c

update app

Browse files
Files changed (2) hide show
  1. app.py +3 -14
  2. requirements.txt +0 -1
app.py CHANGED
@@ -8,7 +8,6 @@ Author:
8
  """
9
  import os
10
  import cv2
11
- import imageio
12
  import gradio as gr
13
  import numpy as np
14
 
@@ -99,26 +98,16 @@ def sequence_prediction(path):
99
  preds = {}
100
  for i in np.argsort(probabilities)[::-1]:
101
  preds[class_vocab[i]] = float(probabilities[i])
102
- gif = to_gif(frames)
103
- return preds, gif
104
-
105
-
106
- def to_gif(images):
107
- converted_images = images.astype(np.uint8)
108
- imageio.mimsave("animation.gif", converted_images, fps=10)
109
- return embed.embed_file(converted_images)
110
 
111
 
112
  article = article = "<div style='text-align: center;'><a href='https://github.com/ChainYo' target='_blank'>Space by Thomas Chaigneau</a><br><a href='https://keras.io/examples/vision/video_classification/' target='_blank'>Keras example by Sayak Paul</a></div>"
113
  app = gr.Interface(
114
  sequence_prediction,
115
  inputs=[gr.inputs.Video(label="Video", type="avi")],
116
- outputs=[
117
- gr.outputs.Label(label="Prediction", type="confidences"),
118
- gr.outputs.Image(label="GIF", type="gif"),
119
- ],
120
  title="Keras Video Classification CNN-RNN model",
121
  description="Keras Working Group",
122
  article=article,
123
- # examples=samples
124
  ).launch(enable_queue=True)
 
8
  """
9
  import os
10
  import cv2
 
11
  import gradio as gr
12
  import numpy as np
13
 
 
98
  preds = {}
99
  for i in np.argsort(probabilities)[::-1]:
100
  preds[class_vocab[i]] = float(probabilities[i])
101
+ return preds
 
 
 
 
 
 
 
102
 
103
 
104
  article = article = "<div style='text-align: center;'><a href='https://github.com/ChainYo' target='_blank'>Space by Thomas Chaigneau</a><br><a href='https://keras.io/examples/vision/video_classification/' target='_blank'>Keras example by Sayak Paul</a></div>"
105
  app = gr.Interface(
106
  sequence_prediction,
107
  inputs=[gr.inputs.Video(label="Video", type="avi")],
108
+ outputs=[gr.outputs.Label(label="Prediction", type="confidences")],
 
 
 
109
  title="Keras Video Classification CNN-RNN model",
110
  description="Keras Working Group",
111
  article=article,
112
+ examples=samples
113
  ).launch(enable_queue=True)
requirements.txt CHANGED
@@ -1,4 +1,3 @@
1
  opencv-python-headless
2
  tensorflow
3
  git+https://github.com/tensorflow/docs
4
- imageio
 
1
  opencv-python-headless
2
  tensorflow
3
  git+https://github.com/tensorflow/docs