code: def transcribe():
      """
      API Endpoint to transcribe a set of audio files.
  
      The files are sorted according to their name, so order may not be same as upload order.
  
      Utilizing the cached info inside the cookies, a model with selected name will be loaded into memory,
      and maybe onto a GPU (if it is supported on the device).
  
      Then the transcription api will be called from the model_api. If all is successful, a template is updated
      with results. If some issue occurs (memory ran out, file is invalid format), notify the user.
      """
      # load model name from cookie
      model_name = request.cookies.get("model_name")
      logging.info(f"Model name : {model_name}")
  
      # If model name is not selected via Load Model, notify user.
      if model_name is None or model_name == "":
          result = render_template(
              "toast_msg.html",
              toast_message="Model has not been initialized !",
              timeout=2000,
          )
          return result
  
      # load whether gpu should be used
      use_gpu_if_available = request.cookies.get("use_gpu") == "on"
      gpu_used = torch.cuda.is_available() and use_gpu_if_available
  
      # Load audio from paths
      uuid = secure_filename(request.cookies.get("uuid", ""))
      data_store = os.path.join(app.config[f"UPLOAD_FOLDER"], uuid)
  
      files = list(glob.glob(os.path.join(data_store, "*.wav")))
  
      # If no files found in cache, notify user
      if len(files) == 0:
          result = render_template(
              "toast_msg.html",
              toast_message="No audio files were found !",
              timeout=2000,
          )
          return result
  
      # transcribe file via model api
      t1 = time.time()
      transcriptions = model_api.transcribe_all(
          files, model_name, use_gpu_if_available=use_gpu_if_available
      )
      t2 = time.time()
  
      # delete all transcribed files immediately
      for fp in files:
          try:
              os.remove(fp)
          except FileNotFoundError:
              logging.info(
                  f"Failed to delete transcribed file : {os.path.basename(fp)}"
              )
  
      # delete temporary transcription directory
      shutil.rmtree(data_store, ignore_errors=True)
  
      # If something happened during transcription, and it failed, notify user.
      if (
          type(transcriptions) == str
          and transcriptions == model_api.TAG_ERROR_DURING_TRANSCRIPTION
      ):
          toast = render_template(
              "toast_msg.html",
              toast_message=f"Failed to transcribe files due to unknown reason. "
              f"Please provide 16 KHz Monochannel wav files onle.",
              timeout=5000,
          )
          transcriptions = ["" for _ in range(len(files))]
  
      else:
          # Transcriptions obtained successfully, notify user.
          toast = render_template(
              "toast_msg.html",
              toast_message=f"Transcribed {len(files)} files using {model_name} (gpu={gpu_used}), "
              f"in {(t2 - t1): 0.2f} s",
              timeout=5000,
          )
  
      # Write results to data table
      results = []
      for filename, transcript in zip(files, transcriptions):
          results.append(
              dict(
                  filename=os.path.basename(filename),
                  transcription=transcript,
              )
          )
  
      result = render_template("transcripts.html", transcripts=results)
      result = toast + result
      result = unescape(result)
  
      result = make_response(result)
      result.set_cookie("uuid", "", expires=0)
      return result
  
imports: import atexit
  import glob
  import os
  import shutil
  import time
  from html import unescape
  from uuid import uuid4
  import model_api
  import torch
  import werkzeug
  from flask import Flask, make_response, render_template, request, url_for
  from flask_cors import CORS
  from werkzeug.utils import secure_filename
  from nemo.utils import logging
label_desc: Use image node_id 6 for calling a global function with example usage: transcribe() and returns: result, result, result