Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,29 +9,6 @@ from Gradio_UI import GradioUI
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
-
def no1_song_checker(year:int, month:int, day:int)-> str: #it's import to specify the return type
|
| 13 |
-
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
-
"""This tool will tell you what was the no.1 song on Billboard top 100 song chart on any give date historically. Look up with it what was the jam that was most popular in the US on your birthday, graduation, etc!
|
| 15 |
-
Args:
|
| 16 |
-
year: The year of the chart date
|
| 17 |
-
month: The month of the chart date
|
| 18 |
-
day: The day of the chart date
|
| 19 |
-
"""
|
| 20 |
-
|
| 21 |
-
try:
|
| 22 |
-
#API call string
|
| 23 |
-
chartdate = f"{year}-{month:02d}-{day:02d}"
|
| 24 |
-
url = f"https://raw.githubusercontent.com/mhollingshead/billboard-hot-100/main/date/{chartdate}.json"
|
| 25 |
-
#Get the no.1 song
|
| 26 |
-
response = requests.get(url).json()
|
| 27 |
-
no1_song_data = response["data"][0]
|
| 28 |
-
song_title = no1_song_data["song"]
|
| 29 |
-
artist = no1_song_data["artist"]
|
| 30 |
-
|
| 31 |
-
return f"The tune that was jammed to the most in the US on {chartdate} was...{song_title} number {artist}!"
|
| 32 |
-
except Exception as e:
|
| 33 |
-
return f"Error loading the music: {str(e)}"
|
| 34 |
-
|
| 35 |
def no1_song_checker(year:int, month:int, day:int)-> str:
|
| 36 |
"""This tool will tell you what was the no.1 song on Billboard top 100 song chart on any give date historically. Look up with it what was the jam that was most popular in the US on your birthday, graduation, etc!
|
| 37 |
Args:
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
def no1_song_checker(year:int, month:int, day:int)-> str:
|
| 13 |
"""This tool will tell you what was the no.1 song on Billboard top 100 song chart on any give date historically. Look up with it what was the jam that was most popular in the US on your birthday, graduation, etc!
|
| 14 |
Args:
|