Download app/__init__.py from Genos77/ParkinsonDetection: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/Genos77/ParkinsonDetection/resolve/main/app/__init__.py
- Command line
-
hf download hf://Genos77/ParkinsonDetection/app/__init__.py
-
curl -L -o __init__.py https://huggingface.co/Genos77/ParkinsonDetection/resolve/main/app/__init__.py
1.08 kB
| import os | |
| from flask import Flask | |
| from flask_sqlalchemy import SQLAlchemy | |
| from flask_login import LoginManager | |
| from flask_migrate import Migrate | |
| from flask_mail import Mail | |
| from config import Config | |
| # Initialize extensions | |
| db = SQLAlchemy() | |
| migrate = Migrate() | |
| login = LoginManager() | |
| login.login_view = 'auth.login' # Redirect to login page if user is not authenticated | |
| login.login_message = 'Please log in to access this page.' | |
| mail = Mail() | |
| def create_app(config_class=Config): | |
| app = Flask(__name__) | |
| app.config.from_object(config_class) | |
| # Make sure these folders exist | |
| os.makedirs('temp_uploads', exist_ok=True) | |
| os.makedirs('spectrograms/temp', exist_ok=True) | |
| db.init_app(app) | |
| migrate.init_app(app, db) | |
| login.init_app(app) | |
| mail.init_app(app) | |
| # Register Blueprints | |
| from app.auth import bp as auth_bp | |
| app.register_blueprint(auth_bp, url_prefix='/auth') | |
| from app.routes import bp as main_bp | |
| app.register_blueprint(main_bp) | |
| with app.app_context(): | |
| db.create_all() # Create tables for our models | |
| return app |