code: def count_generator_demo_exception():
      def count(n):
          for i in range(int(n)):
              time.sleep(0.1)
              if i == 5:
                  raise ValueError("Oh no!")
              yield i
  
      def show(n):
          return str(list(range(int(n))))
  
      with gr.Blocks() as demo:
          with gr.Column():
              num = gr.Number(value=10)
              with gr.Row():
                  count_btn = gr.Button("Count")
                  count_forever = gr.Button("Count forever")
          with gr.Column():
              out = gr.Textbox()
  
          count_btn.click(count, num, out, api_name="count")
          count_forever.click(
              show, num, out, api_name="count_forever", every=3
          )
      return demo
  
imports: import inspect
  import random
  import time
  import gradio
  import pytest
  from pydub import AudioSegment
label_desc: Use image node_id 11 for calling a global function with example usage: count_generator_demo_exception() and returns: demo, str