<commit_before>#!/usr/bin/env python
import os
from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def root():
	genres = ('Hip Hop', 'Electronic', 'R&B')
	songs = [\
			{ 'rank':'1', 'title':'The Motto', 'artist':'Drake', 'year':'2013', 'genre':'Rap' },\
			{ 'rank':'2', 'title':'Started from the Bottom', 'artist':'Drake', 'year':'2012', 'genre':'Hip Hop' },\
			{ 'rank':'3', 'title':'Thrift Shop', 'artist':'Macklemore', 'year':'2013', 'genre':'House' }\
			]
	return render_template('index.html', genres=genres, genre=genres[0], songs=songs)

if __name__ == "__main__":
	# Bind to PORT if defined, otherwise default to 5000.
	port = int(os.environ.get('PORT', 5000))
	app.run(host='0.0.0.0', port=port)<commit_msg>Enable submission of new songs via form.<commit_after>#!/usr/bin/env python
import os
from flask import Flask, render_template, request, redirect, url_for

app = Flask(__name__)
genres = ('Hip Hop', 'Electronic', 'R&B')
songs = [\
		{ 'rank':'1', 'title':'The Motto', 'artist':'Drake', 'year':'2013', 'genre':'Hip Hop' },\
		{ 'rank':'2', 'title':'Started from the Bottom', 'artist':'Drake', 'year':'2012', 'genre':'Hip Hop' },\
		{ 'rank':'3', 'title':'Thrift Shop', 'artist':'Macklemore', 'year':'2013', 'genre':'Electronic' }\
		]

@app.route('/')
def index():
	return render_template('index.html', genres=genres, genre=genres[0], songs=songs)

@app.route('/submit')
def submit():
	title = request.args.get('Song Title')
	artist = request.args.get('Artist')
	year = request.args.get('Year')
	genre = request.args.get('Genre')
	songs.append({ 'rank':str(len(songs) + 1), 'title':title, 'artist':artist, 'year':year, 'genre':genre })
	return redirect(url_for('index'))

if __name__ == "__main__":
	# Bind to PORT if defined, otherwise default to 5000.
	port = int(os.environ.get('PORT', 5000))
	app.run(host='0.0.0.0', port=port)
{'fraction_non_alphanumeric': 0.23056443024494142, 'fraction_numerical': 0.03035143769968051, 'mean_word_length': 5.734767025089606, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4270590', 'n_tokens_mistral': 784, 'n_tokens_neox': 693, 'n_words': 156}