Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -383,15 +383,17 @@ async def home(
|
|
383 |
time, '%Y-%m-%d %H:%M:%S'): info for time, info in weather_data.items()}
|
384 |
# Find the time closest to the current time
|
385 |
current_time = datetime.now()
|
386 |
-
closest_time = min(weather_times.keys(),
|
387 |
-
|
388 |
# Extract weather information for the closest time
|
389 |
-
weather_info = weather_times[closest_time]
|
390 |
# Extract temperature and weather from the weather information
|
391 |
-
temperature = float(weather_info.split(
|
392 |
-
|
393 |
-
weather = weather_info.split(', ')[2].split(': ')[1]
|
394 |
# Create a Weather object from the weather data
|
|
|
|
|
395 |
weather = Weather(temperature=temperature, weather=weather)
|
396 |
temperature = weather.temperature
|
397 |
weather = weather.weather
|
|
|
383 |
time, '%Y-%m-%d %H:%M:%S'): info for time, info in weather_data.items()}
|
384 |
# Find the time closest to the current time
|
385 |
current_time = datetime.now()
|
386 |
+
#closest_time = min(weather_times.keys(),
|
387 |
+
# key=lambda time: abs(time - current_time))
|
388 |
# Extract weather information for the closest time
|
389 |
+
#weather_info = weather_times[closest_time]
|
390 |
# Extract temperature and weather from the weather information
|
391 |
+
#temperature = float(weather_info.split(
|
392 |
+
# ', ')[1].split('°C')[0].split(': ')[1])
|
393 |
+
#weather = weather_info.split(', ')[2].split(': ')[1]
|
394 |
# Create a Weather object from the weather data
|
395 |
+
temperature = '20°C'
|
396 |
+
weather = 'Sunny'
|
397 |
weather = Weather(temperature=temperature, weather=weather)
|
398 |
temperature = weather.temperature
|
399 |
weather = weather.weather
|