benjosaur commited on
Commit
d5dc432
·
verified ·
1 Parent(s): c88d71e

Upload tool

Browse files
Files changed (3) hide show
  1. app.py +6 -0
  2. requirements.txt +1 -0
  3. tool.py +20 -0
app.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ from smolagents import launch_gradio_demo
2
+ from tool import SuperheroPartyThemeTool
3
+
4
+ tool = SuperheroPartyThemeTool()
5
+
6
+ launch_gradio_demo(tool)
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ smolagents
tool.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Optional
2
+ from smolagents.tools import Tool
3
+
4
+ class SuperheroPartyThemeTool(Tool):
5
+ name = "superhero_party_theme_generator"
6
+ description = """This tool suggests creative superhero-themed party ideas based on a category.
7
+ It returns a unique party theme idea."""
8
+ inputs = {'category': {'type': 'string', 'description': 'The type of superhero party (e.g)'}}
9
+ output_type = "string"
10
+
11
+ def forward(self, category:str):
12
+ themes = {
13
+ "classic heroes": "Justice League Gala: Guests come dressed as their favorite DC heroes with themed cocktails like 'The Kryptonite Punch'.",
14
+ "villain masquerade": "Gotham Rogues' Ball: A mysterious masquerade where guests dress as classic Batman villains.",
15
+ "futuristic Gotham": "Neo-Gotham Night: A cyberpunk-style party inspired by Batman Beyond, with neon decorations and futuristic gadgets."
16
+ }
17
+ return themes.get(category.lower(), "Themed party idea not found. Try 'classic heroes', 'villain masquerade', or 'futuristic Gotham'.")
18
+
19
+ def __init__(self, *args, **kwargs):
20
+ self.is_initialized = False