Spaces:
Sleeping
Sleeping
| """Weather tools - direct Python implementation""" | |
| import random | |
| def get_forecast(city: str, dates: str) -> str: | |
| """Get the weather forecast for a city during specific dates.""" | |
| conditions = [ | |
| ("Sunny", "☀️", "Perfect for outdoor activities!"), | |
| ("Partly Cloudy", "⛅", "Great weather overall"), | |
| ("Cloudy", "☁️", "Mild and comfortable"), | |
| ("Light Rain", "🌧️", "Bring an umbrella"), | |
| ("Rainy", "🌧️", "Pack rain gear"), | |
| ("Windy", "💨", "Layer up!") | |
| ] | |
| results = [] | |
| results.append(f"🌤️ **Weather Forecast for {city}**") | |
| results.append(f"📅 {dates}") | |
| results.append("---") | |
| for i in range(5): | |
| cond, emoji, tip = random.choice(conditions) | |
| temp_high = random.randint(20, 32) | |
| temp_low = temp_high - random.randint(5, 10) | |
| humidity = random.randint(40, 80) | |
| results.append(f"") | |
| results.append(f"**Day {i+1}:** {emoji} {cond}") | |
| results.append(f" 🌡️ High: {temp_high}°C / Low: {temp_low}°C") | |
| results.append(f" 💧 Humidity: {humidity}%") | |
| results.append(f" 💡 {tip}") | |
| results.append("") | |
| results.append("---") | |
| results.append("🧳 **Packing Tip:** Light layers, comfortable walking shoes, and don't forget sunscreen!") | |
| return "\n".join(results) | |
| def get_packing_list(weather_conditions: str, activity_types: str) -> str: | |
| """Generate a packing list based on weather and activities.""" | |
| items = ["💳 Passport & ID", "🔌 Phone Charger", "🧼 Toiletries"] | |
| if "Rain" in weather_conditions: | |
| items.extend(["☔ Umbrella", "🧥 Raincoat", "🥾 Waterproof shoes"]) | |
| if "Sunny" in weather_conditions: | |
| items.extend(["🕶️ Sunglasses", "🧴 Sunscreen SPF50", "🧢 Hat"]) | |
| if "Cold" in weather_conditions or "Windy" in weather_conditions: | |
| items.extend(["🧥 Warm Jacket", "🧣 Scarf"]) | |
| if "Swimming" in activity_types or "Beach" in activity_types: | |
| items.extend(["🩲 Swimsuit", "🏖️ Beach Towel", "🩴 Flip flops"]) | |
| if "Hiking" in activity_types or "Walking" in activity_types: | |
| items.extend(["🥾 Hiking Shoes", "🎒 Backpack", "🧺 Water Bottle"]) | |
| if "Dinner" in activity_types or "Nightlife" in activity_types: | |
| items.extend(["👔 Smart Casual Outfit", "👞 Dress Shoes"]) | |
| return "🧳 **Recommended Packing List:**\n\n" + "\n".join(f"• {item}" for item in items) | |