aliashraf1758 commited on
Commit
a73122b
·
verified ·
1 Parent(s): f2dcc50

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -0
app.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ import os
14
+ from dotenv import load_dotenv
15
+
16
+ # Load environment variables
17
+ load_dotenv()
18
+
19
+ app = Flask(__name__)
20
+ app.secret_key = os.environ.get('SECRET_KEY', 'fallback_secret_key_for_development')
21
+
22
+ # Initialize login manager
23
+ init_app(app)
24
+
25
+ # Register blueprints
26
+ app.register_blueprint(pix2text_bp)
27
+ app.register_blueprint(table_bp)
28
+ app.register_blueprint(scribble_bp)
29
+ app.register_blueprint(pdf_bp)
30
+ app.register_blueprint(pdffly_bp, url_prefix='/pdffly')
31
+ app.register_blueprint(graph_bp)
32
+ app.register_blueprint(auth_bp, url_prefix='/auth')
33
+ app.register_blueprint(chatbot_bp, url_prefix='/chatbot')
34
+ app.register_blueprint(pricing_bp)
35
+
36
+ @app.route('/')
37
+ @login_required
38
+ def index():
39
+ return render_template('index.html')
40
+
41
+ # Health check endpoint for Hugging Face Spaces
42
+ @app.route('/health')
43
+ def health():
44
+ return {'status': 'ok'}
45
+
46
+ if __name__ == '__main__':
47
+ # Use the PORT environment variable for Hugging Face Spaces
48
+ port = int(os.environ.get('PORT', 5000))
49
+ app.run(host='0.0.0.0', port=port, debug=False)