code: def predict(audio_path):
      start_time = timer()
      wavform, sample_rate = torchaudio.load(audio_path)
      wav = resample(wavform, sample_rate, SAMPLE_RATE)
      if len(wav) > int(AUDIO_LEN * SAMPLE_RATE):
          wav = wav[: int(AUDIO_LEN * SAMPLE_RATE)]
      else:
          print(
              f"input length {len(wav)} too small!, need over {int(AUDIO_LEN * SAMPLE_RATE)}"
          )
          return
      img = audio_preprocess(wav, SAMPLE_RATE).unsqueeze(0)
      model.eval()
      with torch.inference_mode():
          pred_probs = torch.softmax(model(img), dim=1)
      pred_labels_and_probs = {
          LABELS[i]: float(pred_probs[0][i]) for i in range(len(LABELS))
      }
      pred_time = round(timer() - start_time, 5)
      return pred_labels_and_probs, pred_time
  
imports: import gradio
  import torch
  import torchaudio
  from timeit import default_timer
  from data_setups import audio_preprocess, resample
  import gdown
label_desc: Use image node_id 1 for calling a global function with example usage: predict(audio_path) and returns: pred_labels_and_probs,  pred_time