class_docstr: A base class for the functions used by the agent. Subclass this and implement the `__call__` method as well as the
  following class attributes:
  
  - **description** (`str`) -- A short description of what your tool does, the inputs it expects and the output(s) it
    will return. For instance 'This is a tool that downloads a file from a `url`. It takes the `url` as input, and
    returns the text contained in the file'.
  - **name** (`str`) -- A performative name that will be used for your tool in the prompt to the agent. For instance
    `"text-classifier"` or `"image_generator"`.
  - **inputs** (`List[str]`) -- The list of modalities expected for the inputs (in the same order as in the call).
    Modalitiies should be `"text"`, `"image"` or `"audio"`. This is only used by `launch_gradio_demo` or to make a
    nice space from your tool.
  - **outputs** (`List[str]`) -- The list of modalities returned but the tool (in the same order as the return of the
    call method). Modalitiies should be `"text"`, `"image"` or `"audio"`. This is only used by `launch_gradio_demo`
    or to make a nice space from your tool.
  
  You can also override the method [`~Tool.setup`] if your tool as an expensive operation to perform before being
  usable (such as loading a model). [`~Tool.setup`] will be called the first time you use your tool, but not at
  instantiation.
class_docstr_tok: ["A","base","class","for","the","functions","used","by","the","agent",".","Subclass","this","and","implement","the","`","__call__","`","method","as","well","as","the","following","class","attributes",":","-","*","*","description","*","*","(","`","str","`",")","--","A","short","description","of","what","your","tool","does",",","the","inputs","it","expects","and","the","output","(","s",")","it","will","return",".","For","instance","'This","is","a","tool","that","downloads","a","file","from","a","`","url","`",".","It","takes","the","`","url","`","as","input",",","and","returns","the","text","contained","in","the","file","'",".","-","*","*","name","*","*","(","`","str","`",")","--","A","performative","name","that","will","be","used","for","your","tool","in","the","prompt","to","the","agent",".","For","instance","`","``","text-classifier","''","`","or","`","``","image_generator","''","`",".","-","*","*","inputs","*","*","(","`","List","[","str","]","`",")","--","The","list","of","modalities","expected","for","the","inputs","(","in","the","same","order","as","in","the","call",")",".","Modalitiies","should","be","`","``","text","''","`",",","`","``","image","''","`","or","`","``","audio","''","`",".","This","is","only","used","by","`","launch_gradio_demo","`","or","to","make","a","nice","space","from","your","tool",".","-","*","*","outputs","*","*","(","`","List","[","str","]","`",")","--","The","list","of","modalities","returned","but","the","tool","(","in","the","same","order","as","the","return","of","the","call","method",")",".","Modalitiies","should","be","`","``","text","''","`",",","`","``","image","''","`","or","`","``","audio","''","`",".","This","is","only","used","by","`","launch_gradio_demo","`","or","to","make","a","nice","space","from","your","tool",".","You","can","also","override","the","method","[","`","~Tool.setup","`","]","if","your","tool","as","an","expensive","operation","to","perform","before","being","usable","(","such","as","loading","a","model",")",".","[","`","~Tool.setup","`","]","will","be","called","the","first","time","you","use","your","tool",",","but","not","at","instantiation","."]
docstr: Creates a [`Tool`] from a gradio tool.
docstr_tok: ["Creates","a","[","`","Tool","`","]","from","a","gradio","tool","."]
code: def from_gradio(gradio_tool):
      """
      Creates a [`Tool`] from a gradio tool.
      """
  
      class GradioToolWrapper(Tool):
          def __init__(self, _gradio_tool):
              super().__init__()
              self.name = _gradio_tool.name
              self.description = _gradio_tool.description
  
      GradioToolWrapper.__call__ = gradio_tool.run
      return GradioToolWrapper(gradio_tool)
  
imports: import base64
  import importlib
  import inspect
  import io
  import json
  import os
  import tempfile
  from typing import Any, Dict, List, Optional, Union
  from huggingface_hub import create_repo, hf_hub_download, metadata_update, upload_folder
  from huggingface_hub.utils import RepositoryNotFoundError, build_hf_headers, get_session
  from ..dynamic_module_utils import custom_object_save, get_class_from_dynamic_module, get_imports
  from ..image_utils import is_pil_image
  from ..models.auto import AutoProcessor
  from ..utils import CONFIG_NAME, cached_file, is_accelerate_available, is_torch_available, is_vision_available, logging
  from .agent_types import handle_agent_inputs, handle_agent_outputs
label_desc: Use image node_id 7 for calling the Tool obj's underlying member method code with example usage: obj.from_gradio(gradio_tool) and returns: GradioToolWrapper