-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
67 lines (51 loc) · 1.99 KB
/
app.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"""Application entry point"""
import os
from flask import Flask, render_template
from flask_cors import CORS
from flask_sqlalchemy import SQLAlchemy
from dotenv import load_dotenv
from database import db
from flask_migrate import Migrate
load_dotenv()
app = Flask(__name__)
cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY')
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('SQLALCHEMY_DATABASE_URI')
# postgresql://mura:mura@localhost:5432/mura
db.init_app(app)
migrate = Migrate(app, db)
from models import users
from api.yi import chat
from api.auth import auth
from api.save_chat import save_chat
app.register_blueprint(chat, url_prefix='/api')
app.register_blueprint(auth, url_prefix='/auth')
app.register_blueprint(save_chat)
@app.route('/')
def landing_page():
return render_template('index.html')
@app.route('/settings')
def settings():
return render_template('index.html')
@app.route('/signup')
def signup_page():
"""Sign Up Page"""
return render_template('signup.html')
@app.route('/login')
def login_page():
"""Log in Page"""
return render_template('login.html')
@app.route('/chat')
def home():
"""Home Page - generate"""
items = [
{'title': 'Nutrition & Diet', 'description': 'What are healthy breakfast options for someone with high cholesterol?'},
{'title': 'Mental Health', 'description': 'What are the signs of anxiety and how can it be treated?'},
{'title': 'Women\'s Health', 'description': 'What are the best exercises during pregnancy?'},
{'title': 'Exercise and Fitness', 'description': 'How many steps per day are recommended for maintaining heart health?'},
{'title': 'Cancer', 'description': 'How effective is immunotherapy in treating breast cancer?'},
{'title': 'Diabetes', 'description': 'What are the differences between Type 1 and Type 2 diabetes?'},
]
return render_template('generate.html', items=items)
if __name__ == '__main__':
app.run()