Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,6 +17,10 @@ os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://cloud.langfuse.com/api/publ
|
|
17 |
# os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://us.cloud.langfuse.com/api/public/otel" # US data region
|
18 |
os.environ["OTEL_EXPORTER_OTLP_HEADERS"] = f"Authorization=Basic {LANGFUSE_AUTH}"
|
19 |
|
|
|
|
|
|
|
|
|
20 |
# Define Zodiac signs and their boundaries (0° to 360° ecliptic longitude)
|
21 |
ZODIAC_SIGNS = [
|
22 |
("Aries", 0, 30),
|
@@ -128,9 +132,7 @@ def get_moon_info(date_time: str) -> dict:
|
|
128 |
user_time = datetime.datetime.strptime(date_time, "%Y-%m-%dT%H:%M:%S")
|
129 |
user_time = pytz.utc.localize(user_time)
|
130 |
|
131 |
-
#
|
132 |
-
planets = load('https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/a_old_versions/de421.bsp')
|
133 |
-
ts = load.timescale()
|
134 |
t = ts.from_datetime(user_time)
|
135 |
|
136 |
# Define celestial bodies
|
@@ -138,9 +140,9 @@ def get_moon_info(date_time: str) -> dict:
|
|
138 |
moon = planets['moon']
|
139 |
sun = planets['sun']
|
140 |
|
141 |
-
|
142 |
astrometric = earth.at(t).observe(moon)
|
143 |
-
|
144 |
lon_deg = ecliptic_lon.degrees % 360
|
145 |
|
146 |
# Calculate the phase angle using almanac.moon_phase
|
@@ -199,7 +201,7 @@ def get_moon_info(date_time: str) -> dict:
|
|
199 |
}
|
200 |
|
201 |
except Exception as e:
|
202 |
-
|
203 |
|
204 |
@tool
|
205 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
17 |
# os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://us.cloud.langfuse.com/api/public/otel" # US data region
|
18 |
os.environ["OTEL_EXPORTER_OTLP_HEADERS"] = f"Authorization=Basic {LANGFUSE_AUTH}"
|
19 |
|
20 |
+
# Load ephemeris and timescale
|
21 |
+
planets = load('https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de440.bsp')
|
22 |
+
ts = load.timescale()
|
23 |
+
|
24 |
# Define Zodiac signs and their boundaries (0° to 360° ecliptic longitude)
|
25 |
ZODIAC_SIGNS = [
|
26 |
("Aries", 0, 30),
|
|
|
132 |
user_time = datetime.datetime.strptime(date_time, "%Y-%m-%dT%H:%M:%S")
|
133 |
user_time = pytz.utc.localize(user_time)
|
134 |
|
135 |
+
# Use loaded ephemeris and timescale
|
|
|
|
|
136 |
t = ts.from_datetime(user_time)
|
137 |
|
138 |
# Define celestial bodies
|
|
|
140 |
moon = planets['moon']
|
141 |
sun = planets['sun']
|
142 |
|
143 |
+
# Calculate Moon's ecliptic longitude
|
144 |
astrometric = earth.at(t).observe(moon)
|
145 |
+
ecliptic_lat, ecliptic_lon, distance = astrometric.ecliptic_latlon()
|
146 |
lon_deg = ecliptic_lon.degrees % 360
|
147 |
|
148 |
# Calculate the phase angle using almanac.moon_phase
|
|
|
201 |
}
|
202 |
|
203 |
except Exception as e:
|
204 |
+
raise ValueError(f"Error in get_moon_info: {str(e)}")
|
205 |
|
206 |
@tool
|
207 |
def get_current_time_in_timezone(timezone: str) -> str:
|