Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@ import geopy
|
|
3 |
import joblib
|
4 |
import gradio as gr
|
5 |
|
6 |
-
|
7 |
# Load the trained model
|
8 |
model = joblib.load('hackathonrf.joblib')
|
9 |
|
@@ -16,6 +15,9 @@ def get_coordinates(location):
|
|
16 |
# Function to get AQI value from OpenWeatherMap API
|
17 |
def get_aqi(latitude, longitude, api_key):
|
18 |
url = f"http://api.openweathermap.org/data/2.5/air_pollution?lat={latitude}&lon={longitude}&appid={api_key}"
|
|
|
|
|
|
|
19 |
return aqi_value
|
20 |
|
21 |
# Function to make prediction
|
|
|
3 |
import joblib
|
4 |
import gradio as gr
|
5 |
|
|
|
6 |
# Load the trained model
|
7 |
model = joblib.load('hackathonrf.joblib')
|
8 |
|
|
|
15 |
# Function to get AQI value from OpenWeatherMap API
|
16 |
def get_aqi(latitude, longitude, api_key):
|
17 |
url = f"http://api.openweathermap.org/data/2.5/air_pollution?lat={latitude}&lon={longitude}&appid={api_key}"
|
18 |
+
response = requests.get(url)
|
19 |
+
data = response.json()
|
20 |
+
aqi_value = data['list'][0]['main']['aqi']
|
21 |
return aqi_value
|
22 |
|
23 |
# Function to make prediction
|