Spaces:
Sleeping
Sleeping
File size: 554 Bytes
b431b93 fee25a4 b431b93 fee25a4 924622b b431b93 924622b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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()
|