Multimodal_festival_agent / tools /text_to_image.py
Jekaterina's picture
Update tools/text_to_image.py
f8a500e verified
raw
history blame contribute delete
644 Bytes
import os
from smolagents import Tool
from huggingface_hub import InferenceClient
class TextToImageTool(Tool):
description = "This tool creates an image according to a prompt, which is a text description."
name = "image_generator"
inputs = {"prompt": {"type": "string", "description": "The image generator prompt. Don't hesitate to add details in the prompt to make the image look better, like 'high-res, photorealistic', etc."}}
output_type = "image"
model = "prithivMLmods/SD3.5-Turbo-Realism-2.0-LoRA"
client = InferenceClient(model)
def forward(self, prompt):
return self.client.text_to_image(prompt)