PR-Branch
#6
by crystalai - opened
Files changed (5)
- README.md+2-2
- app.py+1-1
- image_transformation.py+5-5
- requirements.txt+1-1
- tool_config.json+2-2
3 unmodified lines4567891011123 unmodified linescolorFrom: bluecolorTo: purplesdk: gradiosdk_version: 4.37.2app_file: app.pypinned: falsetags:- tool---3 unmodified lines4567891011123 unmodified linescolorFrom: bluecolorTo: purplesdk: gradiosdk_version: 3.27.0app_file: app.pypinned: falsetags:- tool---
1234from transformers.agents.tools import launch_gradio_demofrom image_transformation import ImageTransformationToollaunch_gradio_demo(ImageTransformationTool)1234from transformers.tools.base import launch_gradio_demofrom image_transformation import ImageTransformationToollaunch_gradio_demo(ImageTransformationTool)
12345614 unmodified lines2122232425262728293020 unmodified lines51525354555657from PIL import Imageimport torchfrom transformers.agents.tools import Toolfrom transformers.utils import (is_accelerate_available,is_vision_available,14 unmodified linesdefault_stable_diffusion_checkpoint = "timbrooks/instruct-pix2pix"description = IMAGE_TRANSFORMATION_DESCRIPTIONinputs = {'image': {"type": "image", "description": "the image to transform"},'prompt': {"type": "string", "description": "the prompt to use to change the image"}}output_type = "image"def __init__(self, device=None, controlnet=None, stable_diffusion=None, **hub_kwargs) -> None:if not is_accelerate_available():20 unmodified linesself.is_initialized = Truedef forward(self, image, prompt):if not self.is_initialized:self.setup()12345614 unmodified lines2122232425262728293020 unmodified lines51525354555657from PIL import Imageimport torchfrom transformers.tools.base import Toolfrom transformers.utils import (is_accelerate_available,is_vision_available,14 unmodified linesdefault_stable_diffusion_checkpoint = "timbrooks/instruct-pix2pix"description = IMAGE_TRANSFORMATION_DESCRIPTIONinputs = {'image': {"type": Image.Image, "description": "the image to transform"},'prompt': {"type": str, "description": "the prompt to use to change the image"}}output_type = Image.Imagedef __init__(self, device=None, controlnet=None, stable_diffusion=None, **hub_kwargs) -> None:if not is_accelerate_available():20 unmodified linesself.is_initialized = Truedef __call__(self, image, prompt):if not self.is_initialized:self.setup()
1234transformers[agents]diffusersaccelerateopencv-python1234transformers @ git+https://github.com/huggingface/transformers@test_compositiondiffusersaccelerateopencv-python
123456{"description": "This is a tool that transforms an image according to a prompt and returns the modified image.","name": "image_transformation","tool_class": "image_transformation.ImageTransformationTool","inputs": {"image": "image", "prompt": "str"},"output_type": "image"123456{"description": "This is a tool that transforms an image according to a prompt. It takes two inputs: `image`, which should be the image to transform, and `prompt`, which should be the prompt to use to change it. The prompt should only contain descriptive adjectives, as if completing the prompt of the original image. It returns the modified image.","name": "image_transformer","tool_class": "image_transformation.ImageTransformationTool","inputs": {"image": "image", "prompt": "str"},"output_type": "image"
README.md+2-2
app.py+1-1
image_transformation.py+5-5
requirements.txt+1-1
tool_config.json+2-2