2cylu2 commited on
Commit
e510344
·
verified ·
1 Parent(s): 3d20579

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -9,8 +9,8 @@ DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
9
  # Create a ModelCard
10
  model_card = ModelCard(
11
  name="S-KEY Detection",
12
- description="Musical key detection using Self-supervised Key Detection.",
13
- author="Yuexuan Kong et al.",
14
  tags=["key detection", "mir"],
15
  )
16
 
@@ -18,13 +18,12 @@ model_card = ModelCard(
18
  def process_fn(input_audio_path):
19
  try:
20
  ext = input_audio_path.split(".")[-1].lower()
 
21
 
22
- detected_key = detect_key(
23
- audio_dir=input_audio_path,
24
- extension=ext,
25
- device=DEVICE
26
- )
27
 
 
28
  if isinstance(detected_key, list):
29
  detected_key = detected_key[0]
30
 
@@ -49,6 +48,7 @@ def process_fn(input_audio_path):
49
  # Build Gradio Endpoint
50
  with gr.Blocks() as demo:
51
  input_audio = gr.Audio(label="Input Audio", type="filepath").harp_required(True)
 
52
  output_audio = gr.Audio(label="Output Audio", type="filepath")
53
  output_labels = gr.JSON(label="Analysis Labels")
54
 
@@ -61,4 +61,4 @@ with gr.Blocks() as demo:
61
 
62
 
63
  if __name__ == "__main__":
64
- demo.queue().launch()
 
9
  # Create a ModelCard
10
  model_card = ModelCard(
11
  name="S-KEY Detection",
12
+ description="Major/Minor Key detection from audio using Self-supervised Key Detection.",
13
+ author="Deezer Research",
14
  tags=["key detection", "mir"],
15
  )
16
 
 
18
  def process_fn(input_audio_path):
19
  try:
20
  ext = input_audio_path.split(".")[-1].lower()
21
+ detected_key = detect_key(input_audio_path, ext, DEVICE)
22
 
23
+ #result = detect_key(audio_path=input_audio_path, extension=ext, device=DEVICE,)
24
+ #return result
 
 
 
25
 
26
+ # Ensure detected_key is a string
27
  if isinstance(detected_key, list):
28
  detected_key = detected_key[0]
29
 
 
48
  # Build Gradio Endpoint
49
  with gr.Blocks() as demo:
50
  input_audio = gr.Audio(label="Input Audio", type="filepath").harp_required(True)
51
+ # output_text = gr.Textbox(label="Detected Key")
52
  output_audio = gr.Audio(label="Output Audio", type="filepath")
53
  output_labels = gr.JSON(label="Analysis Labels")
54
 
 
61
 
62
 
63
  if __name__ == "__main__":
64
+ demo.queue().launch()