code: def create_gif(images):
      pil_images = []
      for image in images:
          if isinstance(image, str):
              response = requests.get(image)
              image = Image.open(BytesIO(response.content))
          else:
              image = Image.fromarray((image * 255).astype(np.uint8))
          pil_images.append(image)
      fp_out = os.path.join(os.path.dirname(__file__), "image.gif")
      img = pil_images.pop(0)
      img.save(
          fp=fp_out,
          format="GIF",
          append_images=pil_images,
          save_all=True,
          duration=400,
          loop=0,
      )
      return fp_out
  
file_path: gradio/demo/fake_diffusion_with_gif/run.py
imports: import gradio
  import numpy
  import time
  import os
  from PIL import Image
  import requests
  from io import BytesIO
label_desc: Use image node_id 1 for calling a global function with example usage: create_gif(images) and returns: fp_out