Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -28,6 +28,9 @@ def air_quality(city):
|
|
28 |
print(weather_df)
|
29 |
|
30 |
weather_df = weather_df.drop(columns=["feelslikemin", "feelslikemax","precipprob", "snow", "snowdepth", "uvindex", "date","city","conditions"]).fillna(0)
|
|
|
|
|
|
|
31 |
X = feature_view.get_batch_data(start_time=start_time)
|
32 |
|
33 |
X = X.drop(columns=["date"]).fillna(0)
|
@@ -39,12 +42,12 @@ def air_quality(city):
|
|
39 |
|
40 |
preds = model.predict(X)
|
41 |
|
42 |
-
predictions = ''
|
43 |
for k in range(7):
|
44 |
predictions += "Predicted AQI on " + (datetime.now() + timedelta(days=k)).strftime('%Y-%m-%d') + ": " + str(int(preds[k]))+"\n"
|
45 |
|
46 |
-
print(predictions)
|
47 |
-
return
|
48 |
|
49 |
|
50 |
demo = gr.Interface(fn=air_quality, title="Air quality predictor",
|
|
|
28 |
print(weather_df)
|
29 |
|
30 |
weather_df = weather_df.drop(columns=["feelslikemin", "feelslikemax","precipprob", "snow", "snowdepth", "uvindex", "date","city","conditions"]).fillna(0)
|
31 |
+
|
32 |
+
start_date = datetime.now() - timedelta(days=1)
|
33 |
+
start_time = int(start_date.timestamp()) * 1000
|
34 |
X = feature_view.get_batch_data(start_time=start_time)
|
35 |
|
36 |
X = X.drop(columns=["date"]).fillna(0)
|
|
|
42 |
|
43 |
preds = model.predict(X)
|
44 |
|
45 |
+
"""predictions = ''
|
46 |
for k in range(7):
|
47 |
predictions += "Predicted AQI on " + (datetime.now() + timedelta(days=k)).strftime('%Y-%m-%d') + ": " + str(int(preds[k]))+"\n"
|
48 |
|
49 |
+
print(predictions)"""
|
50 |
+
return preds
|
51 |
|
52 |
|
53 |
demo = gr.Interface(fn=air_quality, title="Air quality predictor",
|