File size: 1,526 Bytes
f630bbd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2d10ee0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 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)

@app.route('/')
@login_required
def index():
    return render_template('index.html')

if __name__ == '__main__':
    # Get port from environment variable (for Hugging Face Spaces) or default to 5000
    port = int(os.environ.get('PORT', 5000))
    app.run(host='0.0.0.0', port=port, debug=False)