mike23415 commited on
Commit
66de5aa
·
verified ·
1 Parent(s): c28a4eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -1
app.py CHANGED
@@ -628,5 +628,39 @@ def download_result(result_id):
628
  logger.error(f"Download error: {str(e)}")
629
  return jsonify({'error': str(e)}), 500
630
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
631
  if __name__ == '__main__':
632
- app.run(host='0.0.0.0', port=7860, debug=False)
 
628
  logger.error(f"Download error: {str(e)}")
629
  return jsonify({'error': str(e)}), 500
630
 
631
+ @app.route('/', methods=['GET'])
632
+ def home():
633
+ return jsonify({
634
+ 'message': 'Data Analytics API is running!',
635
+ 'version': '1.0.0',
636
+ 'endpoints': {
637
+ 'health': '/api/health',
638
+ 'upload': '/api/upload',
639
+ 'preview': '/api/preview/<file_id>',
640
+ 'analyze': '/api/analyze',
641
+ 'files': '/api/files/<session_id>',
642
+ 'delete': '/api/file/<file_id>',
643
+ 'download': '/api/download/<result_id>'
644
+ },
645
+ 'timestamp': datetime.now().isoformat()
646
+ })
647
+
648
+ @app.errorhandler(404)
649
+ def not_found(error):
650
+ return jsonify({
651
+ 'error': 'Endpoint not found',
652
+ 'message': 'Please check the API documentation',
653
+ 'available_endpoints': [
654
+ '/',
655
+ '/api/health',
656
+ '/api/upload',
657
+ '/api/preview/<file_id>',
658
+ '/api/analyze',
659
+ '/api/files/<session_id>',
660
+ '/api/file/<file_id>',
661
+ '/api/download/<result_id>'
662
+ ]
663
+ }), 404
664
+
665
  if __name__ == '__main__':
666
+ app.run(host='0.0.0.0', port=7860, debug=True)