MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / build_tool

Function build_tool

bmtools/tools/gradio_tools/api.py:8–72  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

6import time
7
8def build_tool(config) -> Tool:
9 tool = Tool(
10 "GradioTool",
11 "Gradio_tools Converter",
12 name_for_model="gradio_tool",
13 description_for_model="Python library for converting Gradio apps into tools that can be leveraged by a large language model (LLM)-based agent to complete its task.",
14 logo_url="https://your-app-url.com/.well-known/logo.png",
15 contact_email="hello@contact.com",
16 legal_info_url="hello@legal.com"
17 )
18 @tool.get("/get_bark")
19 def bark(input : str)-> str:
20 '''Converting text into sounds that sound like a human read it.
21 '''
22 bk = BarkTextToSpeechTool()
23 return bk.run(input)
24 @tool.get("/get_qa")
25 def qa(input : str)-> str:
26 '''Answering questions from the image of the document.
27 '''
28 qa = DocQueryDocumentAnsweringTool()
29 return qa.run(input)
30 @tool.get("/get_imagecaption")
31 def imagecaption(input : str)-> str:
32 '''Creating a caption for an image.
33 '''
34 ic = ImageCaptioningTool()
35 return ic.run(input)
36 @tool.get("/get_promptgenerator")
37 def promptgenerator(input : str)-> str:
38 '''Generating a prompt for stable diffusion and other image and video generators based on text input.
39 '''
40 pg = StableDiffusionPromptGeneratorTool()
41 return pg.run(input)
42 @tool.get("/get_stablediffusion")
43 def stablediffusion(input : str)-> str:
44 '''generate images based on text input.
45 '''
46 sd = StableDiffusionTool()
47 return sd.run(input)
48 @tool.get("/get_texttovideo")
49 def texttovideo(input : str)-> str:
50 '''Creating videos from text.
51 '''
52 tv = TextToVideoTool()
53 return tv.run(input)
54 @tool.get("/get_imgtomsc")
55 def imgtomsc(input : str)-> str:
56 '''Creating music from images.
57 '''
58 im = ImageToMusicTool()
59 return im.run(input)
60 @tool.get("/get_audiotrans")
61 def imgtomsc(input : str)-> str:
62 '''Transcribing an audio file track into text transcript.
63 '''
64 at = WhisperAudioTranscriptionTool()
65 return at.run(input)

Callers

nothing calls this directly

Calls 1

ToolClass · 0.50

Tested by

no test coverage detected