havkarl commited on
Commit
add92b5
·
1 Parent(s): 145d0bd

Adding the band name

Browse files
Files changed (3) hide show
  1. README.md +4 -4
  2. app.py +5 -2
  3. tools/band_name_generator.py +25 -0
README.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
- title: First Agent Template
3
  emoji: ⚡
4
- colorFrom: pink
5
- colorTo: yellow
6
  sdk: gradio
7
  sdk_version: 5.15.0
8
  app_file: app.py
@@ -15,4 +15,4 @@ tags:
15
  - agent-course
16
  ---
17
 
18
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: HS First Agent Template
3
  emoji: ⚡
4
+ colorFrom: #14213dff
5
+ colorTo: #737c9dff
6
  sdk: gradio
7
  sdk_version: 5.15.0
8
  app_file: app.py
 
15
  - agent-course
16
  ---
17
 
18
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -4,8 +4,11 @@ import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
-
8
  from Gradio_UI import GradioUI
 
 
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
@@ -55,7 +58,7 @@ with open("prompts.yaml", 'r') as stream:
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[final_answer], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
 
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
+ from tools.band_name_generator import generate_band_name
8
  from Gradio_UI import GradioUI
9
+ from dotenv import load_dotenv
10
+ load_dotenv()
11
+
12
 
13
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
14
  @tool
 
58
 
59
  agent = CodeAgent(
60
  model=model,
61
+ tools=[final_answer, generate_band_name], ## add your tools here (don't remove final answer)
62
  max_steps=6,
63
  verbosity_level=1,
64
  grammar=None,
tools/band_name_generator.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from smolagents import tool
2
+ import random
3
+
4
+ @tool
5
+ def generate_band_name(first_name: str) -> str:
6
+ """Generates a random band name using the provided first name as inspiration.
7
+
8
+ Args:
9
+ first_name: The first name to use as inspiration for the band name
10
+ """
11
+
12
+ adjectives = [
13
+ "Cosmic", "Electric", "Mystic", "Savage", "Silent",
14
+ "Neon", "Quantum", "Midnight", "Crystal", "Thunder"
15
+ ]
16
+
17
+ nouns = [
18
+ "Dragons", "Warriors", "Prophets", "Wolves", "Riders",
19
+ "Pirates", "Bandits", "Knights", "Wizards", "Rebels"
20
+ ]
21
+
22
+ # Generate the band name using the first name and random elements
23
+ band_name = f"{random.choice(adjectives)} {first_name}'s {random.choice(nouns)}"
24
+
25
+ return f"Your generated band name is: {band_name}"