code: def deploy(
      title: Annotated[
          Optional[str], Option(help="Spaces app title")
      ] = None,
      app_file: Annotated[
          Optional[str], Option(help="File containing the Gradio app")
      ] = None,
  ):
      if (
          os.getenv("SYSTEM") == "spaces"
      ):  # in case a repo with this function is uploaded to spaces
          return
  
      hf_api = huggingface_hub.HfApi()
      whoami = None
      login = False
      try:
          whoami = hf_api.whoami()
          if whoami["auth"]["accessToken"]["role"] != "write":
              login = True
      except OSError:
          login = True
      if login:
          print("Need 'write' access token to create a Spaces repo.")
          huggingface_hub.login(add_to_git_credential=False)
          whoami = hf_api.whoami()
  
      configuration: None | dict = None
      if os.path.exists(readme_file):
          try:
              configuration = huggingface_hub.metadata_load(readme_file)
          except ValueError:
              pass
  
      if configuration is None:
          print(
              f"Creating new Spaces Repo in '{repo_directory}'. Collecting metadata, press Enter to accept default value."
          )
          configuration = add_configuration_to_readme(
              title,
              app_file,
          )
  
      space_id = huggingface_hub.create_repo(
          configuration["title"],
          space_sdk="gradio",
          repo_type="space",
          exist_ok=True,
          space_hardware=configuration.get("hardware"),
      ).repo_id
      hf_api.upload_folder(
          repo_id=space_id,
          repo_type="space",
          folder_path=repo_directory,
      )
      if configuration.get("secrets"):
          for secret_name, secret_value in configuration[
              "secrets"
          ].items():
              huggingface_hub.add_space_secret(
                  space_id, secret_name, secret_value
              )
      print(
          f"Space available at https://huggingface.co/spaces/{space_id}"
      )
  
file_path: gradio/gradio/cli/commands/deploy_space.py
imports: from __future__ import annotations
  import os
  import re
  from typing import Optional
  import huggingface_hub
  from rich import print
  from typer import Option
  from typing_extensions import Annotated
  import gradio
label_desc: Use image node_id 3 for calling a global function with example usage: deploy(title, app_file) without return types