Skip to content

Commit

Permalink
response body for anonymisation updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaldi-sage committed Jun 26, 2023
1 parent 82614ca commit 8102a05
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cv_anonymisation/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def allowed_file(filename):
@app.route('/uploads/<string:name>')
def download_file(name):

return send_from_directory(app.config["DOWNLOAD_FOLDER"], name, as_attachment=False)
return send_from_directory(app.config["DOWNLOAD_FOLDER"], name, as_attachment=True)

@app.route("/anonymise", methods=['GET', 'POST'])
def home():
Expand All @@ -41,13 +41,16 @@ def home():
if file and allowed_file(file.filename):
filename = secure_filename(file.filename) # type: ignore
filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename)
file.save(filepath)
'''file.save(filepath)
ofilename = 'anonymized_cv.txt'
ofilepath = os.path.join(app.config['DOWNLOAD_FOLDER'], ofilename)
with open(ofilepath,'w', encoding='utf-8') as f:
f.write(anonymize(filepath))

return redirect(url_for('download_file', name=ofilename))
f.write(anonymize(filepath))'''
response_body = {
'result': anonymize(filepath),
'message': 'Data processed successfully'
}
return response_body, 200

return render_template('index.html')

Expand Down

0 comments on commit 8102a05

Please sign in to comment.