elchulito89 commited on
Commit
c6b6634
·
verified ·
1 Parent(s): 5300cd2

Update app.py

Browse files

Changed the parameter names

Files changed (1) hide show
  1. app.py +11 -13
app.py CHANGED
@@ -9,25 +9,23 @@ 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 get_zodiac_info(birth_month:str, birth_year: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
  """
15
  A tool that returns your Zodiac sign and Chinese zodiac animal based on birth month and year.
16
 
17
  Args:
18
- birth_month (str): Month of birth (e.g., "February")
19
- birth_year (int): Year of birth (e.g., 1988)
20
-
21
- Returns:
22
- str: Information about zodiac sign and Chinese zodiac animal, or error message
23
  """
24
  try:
25
  # Validate month input
26
- if not isinstance(birth_month, str):
27
  return "Error: Birth month must be a string (e.g., 'February')."
28
 
29
  # Convert month to lowercase for case-insensitive comparison
30
- birth_month = birth_month.lower()
31
 
32
  # Define months and their numerical values for easier date comparison
33
  month_to_num = {
@@ -37,18 +35,18 @@ def get_zodiac_info(birth_month:str, birth_year:int)-> str: #it's import to spec
37
  }
38
 
39
  # Get month number
40
- month_num = month_to_num.get(birth_month)
41
  if month_num is None:
42
  return "Error: Invalid month name provided. Please use full month names (e.g., 'February')."
43
 
44
  # Validate year input
45
- if not isinstance(birth_year, int):
46
  try:
47
- birth_year = int(birth_year)
48
  except (ValueError, TypeError):
49
  return "Error: Birth year must be a valid integer."
50
 
51
- if birth_year < 1900 or birth_year > 2100:
52
  return "Error: Birth year should be between 1900 and 2100."
53
 
54
  # Determine Western zodiac sign
@@ -84,7 +82,7 @@ def get_zodiac_info(birth_month:str, birth_year:int)-> str: #it's import to spec
84
  "Tiger", "Rabbit", "Dragon", "Snake", "Horse", "Goat"]
85
 
86
  # Calculate Chinese zodiac animal
87
- zodiac_animal = chinese_zodiac[birth_year % 12]
88
 
89
  # Return formatted string
90
  return f"You're a {zodiac_sign} and you were born in the year of the {zodiac_animal}."
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def get_zodiac_info(arg1:str, arg2: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
  """
15
  A tool that returns your Zodiac sign and Chinese zodiac animal based on birth month and year.
16
 
17
  Args:
18
+ arg1: the first argument
19
+ arg2: the second argument
20
+
 
 
21
  """
22
  try:
23
  # Validate month input
24
+ if not isinstance(arg1, str):
25
  return "Error: Birth month must be a string (e.g., 'February')."
26
 
27
  # Convert month to lowercase for case-insensitive comparison
28
+ arg1 = arg1.lower()
29
 
30
  # Define months and their numerical values for easier date comparison
31
  month_to_num = {
 
35
  }
36
 
37
  # Get month number
38
+ month_num = month_to_num.get(arg1)
39
  if month_num is None:
40
  return "Error: Invalid month name provided. Please use full month names (e.g., 'February')."
41
 
42
  # Validate year input
43
+ if not isinstance(arg2, int):
44
  try:
45
+ arg2 = int(arg2)
46
  except (ValueError, TypeError):
47
  return "Error: Birth year must be a valid integer."
48
 
49
+ if arg2 < 1900 or arg2 > 2100:
50
  return "Error: Birth year should be between 1900 and 2100."
51
 
52
  # Determine Western zodiac sign
 
82
  "Tiger", "Rabbit", "Dragon", "Snake", "Horse", "Goat"]
83
 
84
  # Calculate Chinese zodiac animal
85
+ zodiac_animal = chinese_zodiac[arg2 % 12]
86
 
87
  # Return formatted string
88
  return f"You're a {zodiac_sign} and you were born in the year of the {zodiac_animal}."