Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,15 +14,11 @@ login(token = os.getenv('nangelov_hf_token'))
|
|
14 |
FOOTBALL_DATA_TOKEN = os.getenv('football_data_token')
|
15 |
|
16 |
@tool
|
17 |
-
def getCompetitionInitials(competition_name: str)
|
18 |
-
"""
|
19 |
-
Returns the competition initials (code) for a given competition name.
|
20 |
|
21 |
Args:
|
22 |
competition_name: A string representing the full name of the competition, e.g., "Premier League" or "Bundesliga".
|
23 |
-
|
24 |
-
Returns:
|
25 |
-
str: The competition code if found, otherwise None.
|
26 |
"""
|
27 |
competitions = {
|
28 |
"WC": "FIFA World Cup",
|
@@ -47,23 +43,14 @@ def getCompetitionInitials(competition_name: str) -> str:
|
|
47 |
return None
|
48 |
|
49 |
@tool
|
50 |
-
def getCompetitionMatchesResultsByDate(competition_code: str, match_date: date)
|
51 |
-
"""
|
52 |
-
Gets football match results for a given competition on a specified date.
|
53 |
|
54 |
Args:
|
55 |
-
|
56 |
match_date: A date representing the date for which to retrieve match results (format: YYYY-MM-DD).
|
57 |
-
|
58 |
-
Returns:
|
59 |
-
dict: The JSON response from the API if successful, or an error message.
|
60 |
-
|
61 |
-
Example:
|
62 |
-
>>> from datetime import date
|
63 |
-
>>> results = getCompetitionMatchesResultsByDate("PL", date(2025, 2, 14))
|
64 |
-
>>> print(results)
|
65 |
"""
|
66 |
-
|
67 |
date_str = match_date.isoformat() # converts date to 'YYYY-MM-DD'
|
68 |
|
69 |
# Create the URL using an f-string
|
|
|
14 |
FOOTBALL_DATA_TOKEN = os.getenv('football_data_token')
|
15 |
|
16 |
@tool
|
17 |
+
def getCompetitionInitials(competition_name: str)-> str:
|
18 |
+
"""A tool that returns the competition initials (code) for a given competition name.
|
|
|
19 |
|
20 |
Args:
|
21 |
competition_name: A string representing the full name of the competition, e.g., "Premier League" or "Bundesliga".
|
|
|
|
|
|
|
22 |
"""
|
23 |
competitions = {
|
24 |
"WC": "FIFA World Cup",
|
|
|
43 |
return None
|
44 |
|
45 |
@tool
|
46 |
+
def getCompetitionMatchesResultsByDate(competition_code: str, match_date: date)-> dict:
|
47 |
+
"""A tool that returns football match results for a given competition on a specified date.
|
|
|
48 |
|
49 |
Args:
|
50 |
+
competition_code: A string representing the code of the competition (e.g., 'PL' for Premier League).
|
51 |
match_date: A date representing the date for which to retrieve match results (format: YYYY-MM-DD).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
"""
|
53 |
+
|
54 |
date_str = match_date.isoformat() # converts date to 'YYYY-MM-DD'
|
55 |
|
56 |
# Create the URL using an f-string
|