code: def generate_speech(
      response,
      speaker,
      model=None,
      processor=None,
      vocoder=None,
      speaker_embedding=None,
      sentence_state=None,
      sr=16000,
      tts_speed=1.0,
      return_as_byte=True,
      return_gradio=False,
      is_final=False,
      verbose=False,
  ):
      if response:
          if model is None or processor is None or vocoder is None:
              processor, model, vocoder = get_tts_model()
          if sentence_state is None:
              sentence_state = init_sentence_state()
  
          sentence, sentence_state, _ = get_sentence(
              response,
              sentence_state=sentence_state,
              is_final=is_final,
              verbose=verbose,
          )
      else:
          sentence = ""
      if sentence:
          if verbose:
              print("begin _predict_from_text")
          audio = _predict_from_text(
              sentence,
              speaker,
              processor=processor,
              model=model,
              vocoder=vocoder,
              speaker_embedding=speaker_embedding,
              return_as_byte=return_as_byte,
              sr=sr,
              tts_speed=tts_speed,
          )
          if verbose:
              print("end _predict_from_text")
      else:
          if verbose:
              print("no audio")
          no_audio = get_no_audio(sr=sr, return_as_byte=return_as_byte)
          if return_gradio:
              import gradio as gr
  
              audio = gr.Audio(value=no_audio, autoplay=False)
          else:
              audio = no_audio
      return audio, sentence, sentence_state
  
imports: from __future__ import annotations
  import base64
  import io
  import time
  from io import BytesIO
  import numpy
  import scipy
  import wavio
  import soundfile
  import torch
  import librosa
  from src.tts_sentence_parsing import init_sentence_state, get_sentence
  from src.tts_utils import prepare_speech, get_no_audio, chunk_speed_change
label_desc: Use image node_id 8 for calling a global function with example usage: generate_speech(response, speaker, model, processor, vocoder, speaker_embedding, sentence_state, sr, tts_speed, return_as_byte, return_gradio, is_final, verbose) and returns: audio,  sentence,  sentence_state