Spaces:
Runtime error
Runtime error
from xml.dom.pulldom import SAX2DOM | |
from ..tool import Tool | |
from gradio_tools.tools import ( | |
BarkTextToSpeechTool, | |
StableDiffusionTool, | |
DocQueryDocumentAnsweringTool, | |
ImageCaptioningTool, | |
StableDiffusionPromptGeneratorTool, | |
TextToVideoTool, | |
ImageToMusicTool, | |
WhisperAudioTranscriptionTool, | |
ClipInterrogatorTool, | |
) | |
from gradio_client.client import Job | |
from gradio_client.utils import QueueError | |
import time | |
def build_tool(config) -> Tool: | |
tool = Tool( | |
"GradioTool", | |
"Gradio_tools Converter", | |
name_for_model="gradio_tool", | |
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.", | |
logo_url="https://your-app-url.com/.well-known/logo.png", | |
contact_email="[email protected]", | |
legal_info_url="[email protected]", | |
) | |
def bark(input: str) -> str: | |
"""Converting text into sounds that sound like a human read it.""" | |
bk = BarkTextToSpeechTool() | |
return bk.run(input) | |
def qa(input: str) -> str: | |
"""Answering questions from the image of the document.""" | |
qa = DocQueryDocumentAnsweringTool() | |
return qa.run(input) | |
def imagecaption(input: str) -> str: | |
"""Creating a caption for an image.""" | |
ic = ImageCaptioningTool() | |
return ic.run(input) | |
def promptgenerator(input: str) -> str: | |
"""Generating a prompt for stable diffusion and other image and video generators based on text input.""" | |
pg = StableDiffusionPromptGeneratorTool() | |
return pg.run(input) | |
def stablediffusion(input: str) -> str: | |
"""generate images based on text input.""" | |
sd = StableDiffusionTool() | |
return sd.run(input) | |
def texttovideo(input: str) -> str: | |
"""Creating videos from text.""" | |
tv = TextToVideoTool() | |
return tv.run(input) | |
def imgtomsc(input: str) -> str: | |
"""Creating music from images.""" | |
im = ImageToMusicTool() | |
return im.run(input) | |
def imgtomsc(input: str) -> str: | |
"""Transcribing an audio file track into text transcript.""" | |
at = WhisperAudioTranscriptionTool() | |
return at.run(input) | |
def imgprompt(input: str) -> str: | |
"""Creating a prompt for StableDiffusion that matches the input image.""" | |
ci = ClipInterrogatorTool() | |
return ci.run(input) | |
return tool | |