AescF commited on
Commit
44d3266
1 Parent(s): e7cd083

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -24,9 +24,11 @@ def classify_audio(filepath):
24
  to
25
  {"country": 0.8339303731918335, "rock":0.11914275586605072}
26
  """
 
27
  preds = pipe(filepath)
28
  # preds = predict_trunc(filepath)
29
  outputs = {}
 
30
  for p in preds:
31
  outputs[p["label"]] = p["score"]
32
  return outputs
@@ -43,7 +45,7 @@ filenames = [[f"./{f}"] for f in filenames]
43
  demo = gr.Interface(
44
  fn=classify_audio,
45
  inputs=gr.Audio(type="filepath"),
46
- outputs=gr.outputs.Label(),
47
  title=title,
48
  description=description,
49
  examples=filenames,
 
24
  to
25
  {"country": 0.8339303731918335, "rock":0.11914275586605072}
26
  """
27
+ start_time = timer()
28
  preds = pipe(filepath)
29
  # preds = predict_trunc(filepath)
30
  outputs = {}
31
+ pred_time = round(timer() - start_time, 5)
32
  for p in preds:
33
  outputs[p["label"]] = p["score"]
34
  return outputs
 
45
  demo = gr.Interface(
46
  fn=classify_audio,
47
  inputs=gr.Audio(type="filepath"),
48
+ outputs=[gr.outputs.Label(),gr.Number(label="Prediction time (s)")]
49
  title=title,
50
  description=description,
51
  examples=filenames,