syk101 commited on
Commit
2d10ee0
·
verified ·
1 Parent(s): 5cf58fa

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -0
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+ from flask import Flask, render_template
3
+ from flask_login import login_required
4
+ from controller.pix2text_controller import pix2text_bp
5
+ from controller.table_controller import table_bp
6
+ from controller.scribble_controller import scribble_bp
7
+ from controller.pdf_controller import pdf_bp
8
+ from controller.graph_controller import graph_bp
9
+ from controller.auth_controller import auth_bp, init_app
10
+ from controller.pdffly_controller import pdffly_bp
11
+ from controller.chatbot_controller import chatbot_bp
12
+ from controller.pricing_controller import pricing_bp
13
+
14
+ import os
15
+ from dotenv import load_dotenv
16
+
17
+ # Load environment variables
18
+ load_dotenv()
19
+
20
+ app = Flask(__name__)
21
+ app.secret_key = os.environ.get('SECRET_KEY', 'fallback_secret_key_for_development')
22
+
23
+ # Initialize login manager
24
+ init_app(app)
25
+
26
+ # Register blueprints
27
+ app.register_blueprint(pix2text_bp)
28
+ app.register_blueprint(table_bp)
29
+ app.register_blueprint(scribble_bp)
30
+ app.register_blueprint(pdf_bp)
31
+ app.register_blueprint(pdffly_bp, url_prefix='/pdffly')
32
+ app.register_blueprint(graph_bp)
33
+ app.register_blueprint(auth_bp, url_prefix='/auth')
34
+ app.register_blueprint(chatbot_bp, url_prefix='/chatbot')
35
+ app.register_blueprint(pricing_bp)
36
+
37
+ @app.route('/')
38
+ @login_required
39
+ def index():
40
+ return render_template('index.html')
41
+
42
+ if __name__ == '__main__':
43
+ # Get port from environment variable (for Hugging Face Spaces) or default to 5000
44
+ port = int(os.environ.get('PORT', 5000))
45
+ app.run(host='0.0.0.0', port=port, debug=False)