Skip to content

Commit

Permalink
v3
Browse files Browse the repository at this point in the history
  • Loading branch information
gachouchani1999 committed Sep 19, 2021
1 parent 635d4a1 commit 3f1bf70
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
50 changes: 27 additions & 23 deletions flaskr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,35 @@
from flask import Flask, send_file
from . import doc_reader

def create_app(test_config=None):

app = Flask(__name__, instance_relative_config=True)
app = Flask(__name__, instance_relative_config=True)

@app.route('/', methods=['GET', 'POST'])
def upload_file():
@app.route('/', methods=['GET', 'POST'])
def upload_file():
return render_template('upload.html')


@app.route('/uploader', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
global f
f = request.files['file']
theme = request.form['theme']
f.save(secure_filename(f.filename))
doc_reader.final_create(int(theme),f.filename)
return render_template('download.html')

@app.route('/download')
def download():
filename_new = f.filename[:f.filename.find('.')]
path = '../'+filename_new + '.pptx'
return send_file(path, as_attachment=True)


@app.route('/uploader', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
global f
f = request.files['file']
theme = request.form['theme']
f.save(secure_filename(f.filename))
doc_reader.final_create(int(theme),f.filename)
return render_template('download.html')



@app.route('/download')
def download():
filename_new = f.filename[:f.filename.find('.')]
path = '../'+filename_new + '.pptx'
return send_file(path, as_attachment=True)


Bootstrap (app)
return app
Bootstrap (app)

if __name__ == '__main__':
# Threaded option to enable multiple instances for multiple user access support
app.run(threaded=True, port=5000)
2 changes: 1 addition & 1 deletion flaskr/doc_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def final_create(theme,filename):
a = doc_analyzer.summarize_heading(par.text)

headings.append(a)
title_headings.append("Page " + i)
title_headings.append("Page " + str(i))

filename_new = filename[:filename.find('.')].title()

Expand Down

0 comments on commit 3f1bf70

Please sign in to comment.