Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,14 +7,17 @@ from gradio_client import Client
|
|
| 7 |
class TextToImageTool(Tool):
|
| 8 |
name = "text_to_image"
|
| 9 |
description = "Generate an image from a text prompt using m-ric/text-to-image."
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def __init__(self):
|
| 12 |
super().__init__()
|
| 13 |
-
self.client = Client("m-ric/text-to-image")
|
| 14 |
|
| 15 |
def run(self, prompt: str):
|
| 16 |
image = self.client.predict(prompt, api_name="/predict")
|
| 17 |
-
return image #
|
|
|
|
| 18 |
|
| 19 |
#%% Utility functions
|
| 20 |
def add_label_to_image(image, label):
|
|
|
|
| 7 |
class TextToImageTool(Tool):
|
| 8 |
name = "text_to_image"
|
| 9 |
description = "Generate an image from a text prompt using m-ric/text-to-image."
|
| 10 |
+
inputs = ["prompt"] # Required by smolagents
|
| 11 |
+
outputs = ["image"] # Not used directly but required
|
| 12 |
|
| 13 |
def __init__(self):
|
| 14 |
super().__init__()
|
| 15 |
+
self.client = Client("m-ric/text-to-image")
|
| 16 |
|
| 17 |
def run(self, prompt: str):
|
| 18 |
image = self.client.predict(prompt, api_name="/predict")
|
| 19 |
+
return image # PIL.Image
|
| 20 |
+
|
| 21 |
|
| 22 |
#%% Utility functions
|
| 23 |
def add_label_to_image(image, label):
|