aishitdharwal commited on
Commit
b431b93
·
1 Parent(s): 5d46c5a

add files

Browse files
Files changed (2) hide show
  1. app.py +13 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import gradio as gr
3
+
4
+ def should_play(city):
5
+ api_key = "bb5a3b68cd874753bf565453251804"
6
+ url = "http://api.weatherapi.com/v1/current.json"
7
+ params = {"q": city, "key": api_key}
8
+ res = requests.get(url, params=params).json()
9
+ condition = res["current"]["condition"]["text"].lower()
10
+ decision = "Don't Play Cricket" if "rain" in condition else "Go Play Cricket!"
11
+ return f"{city}: {condition.title()} → {decision}"
12
+
13
+ gr.Interface(fn=should_play, inputs="text", outputs="text", title="Cricket Decision App").launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ requests