hcho22 commited on
Commit
a6a32a2
·
verified ·
1 Parent(s): 3d8f11f

Upload tool

Browse files
Files changed (3) hide show
  1. app.py +6 -0
  2. requirements.txt +1 -0
  3. tool.py +22 -0
app.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ from smolagents import launch_gradio_demo
2
+ from tool import PizzaPartyThemeTool
3
+
4
+ tool = PizzaPartyThemeTool()
5
+
6
+ launch_gradio_demo(tool)
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ smolagents
tool.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Optional
2
+ from smolagents.tools import Tool
3
+
4
+ class PizzaPartyThemeTool(Tool):
5
+ name = "pizza_party_theme_generator"
6
+ description = """
7
+ This tool suggests creative pizza-themed party ideas based on a category.
8
+ It returns a unique party theme idea."""
9
+ inputs = {'category': {'type': 'string', 'description': "The type of pizza party (e.g., 'cheese', 'pepperoni','combination')."}}
10
+ output_type = "string"
11
+
12
+ def forward(self, category: str):
13
+ themes = {
14
+ "cheese": "Super Cheezy: Guests come dressed as their favorite type of cheese",
15
+ "pepperoni": "Pepperoni Ball: A mysterious masquerade where guests dress as pepperoni, sausage, or salami.",
16
+ "combination": "Combination Night: Guests dress as freely as they wish, combining all their ingredients."
17
+ }
18
+
19
+ return themes.get(category.lower(), "Themed party idea not found. Try 'cheese', 'pepperoni', or 'combination'.")
20
+
21
+ def __init__(self, *args, **kwargs):
22
+ self.is_initialized = False