thecho7 commited on
Commit
da202d4
·
1 Parent(s): 49e0d41

dict Model

Browse files
Files changed (2) hide show
  1. app.py +3 -3
  2. kernel_utils.py +2 -1
app.py CHANGED
@@ -68,14 +68,14 @@ model = model_fn(model_dir)
68
 
69
  """
70
  if __name__ == '__main__':
71
- video_path = "nlurbvsozt.mp4"
72
  model = model_fn(model_dir)
73
- a, b = predict_fn([model], video_path, meta)
74
  print(a, b)
75
  """
76
  # Create the Gradio demo
77
  demo = gr.Interface(fn=predict_fn, # mapping function from input to output
78
- inputs=[[model], gr.Video(autosize=True), meta],
79
  outputs=[gr.Label(num_top_classes=2, label="Predictions"), # what are the outputs?
80
  gr.Number(label="Prediction time (s)")], # our fn has two outputs, therefore we have two outputs
81
  examples=example_list,
 
68
 
69
  """
70
  if __name__ == '__main__':
71
+ video_path = "examples/nlurbvsozt.mp4"
72
  model = model_fn(model_dir)
73
+ a, b = predict_fn(model, video_path, meta)
74
  print(a, b)
75
  """
76
  # Create the Gradio demo
77
  demo = gr.Interface(fn=predict_fn, # mapping function from input to output
78
+ inputs=[model, gr.Video(), meta],
79
  outputs=[gr.Label(num_top_classes=2, label="Predictions"), # what are the outputs?
80
  gr.Number(label="Prediction time (s)")], # our fn has two outputs, therefore we have two outputs
81
  examples=example_list,
kernel_utils.py CHANGED
@@ -333,7 +333,8 @@ def predict_on_video(face_extractor, video_path, batch_size, input_size, models,
333
  # Make a prediction, then take the average.
334
  with torch.no_grad():
335
  preds = []
336
- for model in models:
 
337
  if device == 'cpu':
338
  y_pred = model(x[:n])
339
  else:
 
333
  # Make a prediction, then take the average.
334
  with torch.no_grad():
335
  preds = []
336
+ models_ = [models]
337
+ for model in models_:
338
  if device == 'cpu':
339
  y_pred = model(x[:n])
340
  else: