Sudip Datta commited on
Commit
76f890f
·
1 Parent(s): 07f2b3c

fix spacing

Browse files
Files changed (2) hide show
  1. app.py +0 -29
  2. tools/star_in_my_sky.py +6 -8
app.py CHANGED
@@ -9,17 +9,6 @@ from Gradio_UI import GradioUI
9
  from tools.star_in_my_sky import get_star_visibility
10
 
11
 
12
- # Below is an example of a tool that does nothing. Amaze us with your creativity !
13
- @tool
14
- def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
15
- #Keep this format for the description / args / args description but feel free to modify the tool
16
- """A tool that does nothing yet
17
- Args:
18
- arg1: the first argument
19
- arg2: the second argument
20
- """
21
- return "What magic will you build ?"
22
-
23
  @tool
24
  def is_star_in_my_sky(star_name: str, location_name: str) -> str:
25
  """A tool that checks if a star is currently visible in the sky at a given location.
@@ -33,21 +22,6 @@ def is_star_in_my_sky(star_name: str, location_name: str) -> str:
33
  return f"Error: {str(e)}"
34
  return resp
35
 
36
- @tool
37
- def get_current_time_in_timezone(timezone: str) -> str:
38
- """A tool that fetches the current local time in a specified timezone.
39
- Args:
40
- timezone: A string representing a valid timezone (e.g., 'America/New_York').
41
- """
42
- try:
43
- # Create timezone object
44
- tz = pytz.timezone(timezone)
45
- # Get current time in that timezone
46
- local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
47
- return f"The current local time in {timezone} is: {local_time}"
48
- except Exception as e:
49
- return f"Error fetching time for timezone '{timezone}': {str(e)}"
50
-
51
 
52
  final_answer = FinalAnswerTool()
53
 
@@ -62,9 +36,6 @@ custom_role_conversions=None,
62
  )
63
 
64
 
65
- # Import tool from Hub
66
- # image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
67
-
68
  with open("prompts.yaml", 'r') as stream:
69
  prompt_templates = yaml.safe_load(stream)
70
 
 
9
  from tools.star_in_my_sky import get_star_visibility
10
 
11
 
 
 
 
 
 
 
 
 
 
 
 
12
  @tool
13
  def is_star_in_my_sky(star_name: str, location_name: str) -> str:
14
  """A tool that checks if a star is currently visible in the sky at a given location.
 
22
  return f"Error: {str(e)}"
23
  return resp
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  final_answer = FinalAnswerTool()
27
 
 
36
  )
37
 
38
 
 
 
 
39
  with open("prompts.yaml", 'r') as stream:
40
  prompt_templates = yaml.safe_load(stream)
41
 
tools/star_in_my_sky.py CHANGED
@@ -54,12 +54,10 @@ def get_star_visibility(star_name, location_name):
54
  # 2. Query SIMBAD for the star's RA/DEC
55
  result_table = Simbad.query_object(star_name)
56
  if result_table is None:
57
- print(f"Could not find star '{star_name}' in SIMBAD.")
58
- return
59
 
60
  if "ra" not in result_table.colnames or "dec" not in result_table.colnames:
61
- print("The 'ra'/'dec' columns are missing in SIMBAD’s response!")
62
- return
63
 
64
  ra_str = result_table["ra"][0] # e.g. '06 45 08.92'
65
  dec_str = result_table["dec"][0] # e.g. '-16 42 58.0'
@@ -84,10 +82,10 @@ def get_star_visibility(star_name, location_name):
84
  resp = ""
85
  # 5. Print results
86
  if alt.degrees > 0:
87
- resp = f"""
88
- Star '{star_name}' is above the horizon at {location_name} (NOW).
89
- Altitude: {alt.degrees:.2f}°, Azimuth: {az.degrees:.2f}°
90
- """
91
  else:
92
  resp = f"\nStar '{star_name}' is below the horizon at {location_name} (NOW)."
93
  return resp
 
54
  # 2. Query SIMBAD for the star's RA/DEC
55
  result_table = Simbad.query_object(star_name)
56
  if result_table is None:
57
+ return f"Could not find star '{star_name}' in SIMBAD."
 
58
 
59
  if "ra" not in result_table.colnames or "dec" not in result_table.colnames:
60
+ return "The 'ra'/'dec' columns are missing in SIMBAD’s response!"
 
61
 
62
  ra_str = result_table["ra"][0] # e.g. '06 45 08.92'
63
  dec_str = result_table["dec"][0] # e.g. '-16 42 58.0'
 
82
  resp = ""
83
  # 5. Print results
84
  if alt.degrees > 0:
85
+ resp = (
86
+ f"Star '{star_name}' is above the horizon at {location_name} (NOW).\n"
87
+ f"Altitude: {alt.degrees:.2f}°, Azimuth: {az.degrees:.2f}°"
88
+ )
89
  else:
90
  resp = f"\nStar '{star_name}' is below the horizon at {location_name} (NOW)."
91
  return resp