Spaces:
Runtime error
Runtime error
Upload tool
Browse files- requirements.txt +1 -1
- tool.py +2 -2
requirements.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
-
|
| 2 |
requests
|
| 3 |
smolagents
|
|
|
|
| 1 |
+
PIL
|
| 2 |
requests
|
| 3 |
smolagents
|
tool.py
CHANGED
|
@@ -7,7 +7,7 @@ class SimpleTool(Tool):
|
|
| 7 |
inputs = {'prompt': {'type': 'string', 'description': 'The prompt to generate the image from'}, 'width': {'type': 'integer', 'nullable': True, 'description': 'image width'}, 'height': {'type': 'integer', 'nullable': True, 'description': 'image height'}, 'seed': {'type': 'integer', 'nullable': True, 'description': 'A decimal integer Each seed generates a new image variation Returns generated image as a PILL image'}}
|
| 8 |
output_type = "object"
|
| 9 |
|
| 10 |
-
def forward(self, prompt: str, width: int = 1024, height: int = 1024, seed: int = 0) -> PIL.Image.Image:
|
| 11 |
"""
|
| 12 |
Generate an image from a prompt
|
| 13 |
Args:
|
|
@@ -28,7 +28,7 @@ class SimpleTool(Tool):
|
|
| 28 |
seed=random.randint(1,8*1024**2)
|
| 29 |
else:
|
| 30 |
random.seed(seed)
|
| 31 |
-
|
| 32 |
url = f"https://pollinations.ai/p/{prompt}"
|
| 33 |
params={"width":width,"height":height,"seed":seed}
|
| 34 |
response = requests.get(url)
|
|
|
|
| 7 |
inputs = {'prompt': {'type': 'string', 'description': 'The prompt to generate the image from'}, 'width': {'type': 'integer', 'nullable': True, 'description': 'image width'}, 'height': {'type': 'integer', 'nullable': True, 'description': 'image height'}, 'seed': {'type': 'integer', 'nullable': True, 'description': 'A decimal integer Each seed generates a new image variation Returns generated image as a PILL image'}}
|
| 8 |
output_type = "object"
|
| 9 |
|
| 10 |
+
def forward(self, prompt: str, width: int = 1024, height: int = 1024, seed: int = 0) -> 'PIL.Image.Image':
|
| 11 |
"""
|
| 12 |
Generate an image from a prompt
|
| 13 |
Args:
|
|
|
|
| 28 |
seed=random.randint(1,8*1024**2)
|
| 29 |
else:
|
| 30 |
random.seed(seed)
|
| 31 |
+
|
| 32 |
url = f"https://pollinations.ai/p/{prompt}"
|
| 33 |
params={"width":width,"height":height,"seed":seed}
|
| 34 |
response = requests.get(url)
|