Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -509,6 +509,19 @@ def get_commodities():
|
|
509 |
commodities = sorted(df['commodity'].dropna().unique())
|
510 |
return jsonify(commodities)
|
511 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
512 |
if __name__ == '__main__':
|
513 |
-
|
514 |
-
|
|
|
509 |
commodities = sorted(df['commodity'].dropna().unique())
|
510 |
return jsonify(commodities)
|
511 |
|
512 |
+
@app.route('/')
|
513 |
+
def index():
|
514 |
+
try:
|
515 |
+
initial_data = fetch_market_data()
|
516 |
+
states = sorted(initial_data['state'].dropna().unique()) if not initial_data.empty else []
|
517 |
+
except Exception as e:
|
518 |
+
print(f"Error fetching initial data: {str(e)}")
|
519 |
+
states = []
|
520 |
+
|
521 |
+
return render_template('index.html',
|
522 |
+
states=states,
|
523 |
+
today=datetime.today().strftime('%Y-%m-%d'))
|
524 |
+
|
525 |
if __name__ == '__main__':
|
526 |
+
pio.templates.default = "plotly_white"
|
527 |
+
app.run(debug=True, host='0.0.0.0', port=7860)
|