-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
40 lines (26 loc) · 1.06 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
from flask import Flask, render_template, request
import config
import blog
def page_not_found(e):
return render_template('404.html'), 404
app = Flask(__name__)
app.config.from_object(config.config['development'])
app.register_error_handler(404, page_not_found)
@app.route('/', methods=["GET", "POST"])
def index():
if request.method == 'POST':
if 'form1' in request.form:
prompt = request.form['blogTopic']
blogT = blog.generateBlogTopics(prompt)
blogTopicIdeas = blogT.replace('\n', '<br>')
if 'form2' in request.form:
prompt = request.form['blogSection']
blogT = blog.generateBlogSections(prompt)
blogSectionIdeas = blogT.replace('\n', '<br>')
if 'form3' in request.form:
prompt = request.form['blogExpander']
blogT = blog.blogSectionExpander(prompt)
blogExpanded = blogT.replace('\n', '<br>')
return render_template('index2.html', **locals())
if __name__ == '__main__':
app.run(host='0.0.0.0', port='8888', debug=True)