code: def generate_summary(cursor: evadb.EvaDBCursor):
      """Generate summary of a video transcript if it is too long (exceeds llm token limits)
  
      Args:
          cursor (EVADBCursor): evadb api cursor.
      """
      transcript_list = cursor.query(
          "SELECT text FROM Transcript;"
      ).df()["transcript.text"]
      if len(transcript_list) == 1:
          summary = transcript_list[0]
          df = pd.DataFrame([{"summary": summary}])
          df.to_csv(SUMMARY_PATH)
  
          cursor.query("DROP TABLE IF EXISTS Summary;").execute()
          cursor.query(
              """CREATE TABLE IF NOT EXISTS Summary (summary TEXT(100));"""
          ).execute()
          cursor.query(
              f"LOAD CSV '{SUMMARY_PATH}' INTO Summary;"
          ).execute()
          return
  
      generate_summary_text_query = (
          "SELECT ChatGPT('summarize the video in detail', text) FROM"
          " Transcript;"
      )
      responses = cursor.query(generate_summary_text_query).df()[
          "chatgpt.response"
      ]
      summary = ""
      for r in responses:
          summary += f"{r} \n"
      df = pd.DataFrame([{"summary": summary}])
      df.to_csv(SUMMARY_PATH)
  
      need_to_summarize = len(summary) > MAX_CHUNK_SIZE
      while need_to_summarize:
          partitioned_summary = partition_summary(summary)
  
          df = pd.DataFrame([{"summary": partitioned_summary}])
          df.to_csv(SUMMARY_PATH)
  
          cursor.query("DROP TABLE IF EXISTS Summary;").execute()
          cursor.query(
              """CREATE TABLE IF NOT EXISTS Summary (summary TEXT(100));"""
          ).execute()
          cursor.query(
              f"LOAD CSV '{SUMMARY_PATH}' INTO Summary;"
          ).execute()
  
          generate_summary_text_query = "SELECT ChatGPT('summarize in detail', summary) FROM Summary;"
          responses = cursor.query(generate_summary_text_query).df()[
              "chatgpt.response"
          ]
          summary = " ".join(responses)
  
          # no further summarization is needed if the summary is short enough
          if len(summary) <= MAX_CHUNK_SIZE:
              need_to_summarize = False
  
      # load final summary to table
      cursor.query("DROP TABLE IF EXISTS Summary;").execute()
      cursor.query(
          """CREATE TABLE IF NOT EXISTS Summary (summary TEXT(100));"""
      ).execute()
      cursor.query(f"LOAD CSV '{SUMMARY_PATH}' INTO Summary;").execute()
  
imports: import os
  import shutil
  from typing import Dict, List
  import pandas
  import evadb
  from pytube import YouTube, extract
  from youtube_transcript_api import YouTubeTranscriptApi
label_desc: Use image node_id 10 for calling a global function with example usage: generate_summary(cursor) without return types