Spaces:
Build error
Build error
| # app.py | |
| from flask import Flask, render_template | |
| from flask_login import login_required | |
| from controller.pix2text_controller import pix2text_bp | |
| from controller.table_controller import table_bp | |
| from controller.scribble_controller import scribble_bp | |
| from controller.pdf_controller import pdf_bp | |
| from controller.graph_controller import graph_bp | |
| from controller.auth_controller import auth_bp, init_app | |
| from controller.pdffly_controller import pdffly_bp | |
| from controller.chatbot_controller import chatbot_bp | |
| from controller.pricing_controller import pricing_bp | |
| import os | |
| from dotenv import load_dotenv | |
| # Load environment variables | |
| load_dotenv() | |
| app = Flask(__name__) | |
| app.secret_key = os.environ.get('SECRET_KEY', 'fallback_secret_key_for_development') | |
| # Initialize login manager | |
| init_app(app) | |
| # Register blueprints | |
| app.register_blueprint(pix2text_bp) | |
| app.register_blueprint(table_bp) | |
| app.register_blueprint(scribble_bp) | |
| app.register_blueprint(pdf_bp) | |
| app.register_blueprint(pdffly_bp, url_prefix='/pdffly') | |
| app.register_blueprint(graph_bp) | |
| app.register_blueprint(auth_bp, url_prefix='/auth') | |
| app.register_blueprint(chatbot_bp, url_prefix='/chatbot') | |
| app.register_blueprint(pricing_bp) | |
| def index(): | |
| return render_template('index.html') | |
| # Health check endpoint for Hugging Face Spaces | |
| def health(): | |
| return {'status': 'ok'} | |
| if __name__ == '__main__': | |
| # Use the PORT environment variable for Hugging Face Spaces | |
| port = int(os.environ.get('PORT', 5000)) | |
| app.run(host='0.0.0.0', port=port, debug=False) |