Spaces:
Runtime error
Runtime error
Upload tool
Browse files- app.py +6 -0
- requirements.txt +1 -0
- tool.py +25 -0
app.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from smolagents import launch_gradio_demo
|
2 |
+
from tool import MySuperheroPartyThemeTool
|
3 |
+
|
4 |
+
tool = MySuperheroPartyThemeTool()
|
5 |
+
|
6 |
+
launch_gradio_demo(tool)
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
smolagents
|
tool.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Any, Optional
|
2 |
+
from smolagents.tools import Tool
|
3 |
+
|
4 |
+
class MySuperheroPartyThemeTool(Tool):
|
5 |
+
name = "superhero_party_theme_generator"
|
6 |
+
description = """
|
7 |
+
Suggests provides available party themes for designing parties (if no category argument is provided) and, when it a category
|
8 |
+
is provided, it suggests a single creative superhero-themed party idea. As final answer mix the text of the idea you got
|
9 |
+
with your own evoked thoughs on the theme to give a glamourous description."""
|
10 |
+
inputs = {'category': {'type': 'any', 'description': "Optionally the type of superhero party (e.g., 'classic heroes', 'villain masquerade', 'futuristic Gotham').", 'nullable': True}}
|
11 |
+
output_type = "any"
|
12 |
+
|
13 |
+
def forward(self, category: str | None = None):
|
14 |
+
themes = {
|
15 |
+
"classic heroes": "Justice League Gala: Guests come dressed as their favorite DC heroes with themed cocktails like 'The Kryptonite Punch'.",
|
16 |
+
"villain masquerade": "Gotham Rogues' Ball: A mysterious masquerade where guests dress as classic Batman villains.",
|
17 |
+
"futuristic gotham": "Neo-Gotham Night: A cyberpunk-style party inspired by Batman Beyond, with neon decorations and futuristic gadgets."
|
18 |
+
}
|
19 |
+
if not category:
|
20 |
+
return ", ".join(list(themes.keys()))
|
21 |
+
|
22 |
+
return themes.get(category.lower(), "Themed party idea not found. Try 'classic heroes', 'villain masquerade', or 'futuristic gotham'.")
|
23 |
+
|
24 |
+
def __init__(self, *args, **kwargs):
|
25 |
+
self.is_initialized = False
|