Update tools/text_to_image.py
Browse files- tools/text_to_image.py +2 -1
tools/text_to_image.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from smolagents import Tool
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
|
@@ -8,7 +9,7 @@ class TextToImageTool(Tool):
|
|
| 8 |
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."}}
|
| 9 |
output_type = "image"
|
| 10 |
model = "black-forest-labs/FLUX.1-schnell"
|
| 11 |
-
client = InferenceClient(model)
|
| 12 |
|
| 13 |
|
| 14 |
def forward(self, prompt):
|
|
|
|
| 1 |
+
import os
|
| 2 |
from smolagents import Tool
|
| 3 |
from huggingface_hub import InferenceClient
|
| 4 |
|
|
|
|
| 9 |
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."}}
|
| 10 |
output_type = "image"
|
| 11 |
model = "black-forest-labs/FLUX.1-schnell"
|
| 12 |
+
client = InferenceClient(model, token = os.getenv("HF_API_KEY"))
|
| 13 |
|
| 14 |
|
| 15 |
def forward(self, prompt):
|