<commit_before>#! /usr/bin/env python

import web
import json
from summa import summarizer, keywords

render = web.template.render('templates/', base='layout')
urls = (
    '/', 'autosummarize',
    '/foo','foo',
    '/gexf','gexf'
)		

class foo:
	def GET(self):
		lista = [1,3,5,7]
		web.header('Content-Type', 'application/json')
		return json.dumps({"data":lista})
        
       
class autosummarize:
    def GET(self):
        return render.autosummarize() 
        
    def POST(self):
        textarea = web.input()
        print textarea
        summary = summarizer.summarize(text=textarea.text)
        return render.autosummarize(summary=summary)


class gexf:
    def GET(self):
    	return render.gexf()



if __name__ == "__main__":
    app = web.application(urls, globals())
    app.run()
<commit_msg>Updating application to be made compatible with Gunicorn.<commit_after>#! /usr/bin/env python

import web
import json
import sys, os

# Imports files from a parent directory.
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, 'textrank'))
from summa.summarizer import summarize as textrank
from summa import summarizer, keywords

render = web.template.render('templates/', base='layout')
urls = (
    '/', 'autosummarize',
    '/foo','foo',
    '/gexf','gexf'
)		

class foo:
	def GET(self):
		lista = [1,3,5,7]
		web.header('Content-Type', 'application/json')
		return json.dumps({"data":lista})
        
       
class autosummarize:
    def GET(self):
        return render.autosummarize() 
        
    def POST(self):
        textarea = web.input()
        print textarea
        summary = summarizer.summarize(text=textarea.text)
        return render.autosummarize(summary=summary)


class gexf:
    def GET(self):
    	return render.gexf()


app = web.application(urls, globals())
wsgiapp = app.wsgifunc()

{'fraction_non_alphanumeric': 0.1383378016085791, 'fraction_numerical': 0.004289544235924933, 'mean_word_length': 3.155902004454343, 'pattern_counts': {'":': 3, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '1702114', 'n_tokens_mistral': 649, 'n_tokens_neox': 631, 'n_words': 139}