Spaces:
Sleeping
Sleeping
| import requests | |
| import gradio as gr | |
| def should_play(city): | |
| api_key = "bb5a3b68cd874753bf565453251804" | |
| url = "http://api.weatherapi.com/v1/current.json" | |
| params = {"q": city, "key": api_key} | |
| res = requests.get(url, params=params).json() | |
| condition = res["current"]["condition"]["text"].lower() | |
| decision = "Don't Play Cricket" if "rain" in condition else "Go Play Cricket!" | |
| return f"{city}: {condition.title()} → {decision}" | |
| gr.Interface(fn=should_play, inputs="text", outputs="text", title="Cricket Decision App").launch() | |