Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,17 @@ def home():
@app.route('/decode', methods=['GET'])
def decode_input():
input = request.args.get('input')
number_list = json.loads(input)
if not input:
return jsonify({'error': 'Missing or empty "input" parameter'}), 400
try:
number_list = json.loads(input)
except json.JSONDecodeError as e:
return jsonify({'error': f'Invalid JSON: {str(e)}'}), 400
json_output = decode(lofi2lofi_model, torch.tensor([number_list]).float())
response = jsonify(json_output)
response.headers.add('Access-Control-Allow-Origin', '*')

return response

if __name__ == '__main__':
app.run(debug=True)
app.run(debug=True)