Exemple #1
0
    def main():
        n = 0
        recz = Recz()
        start_read = clock()
        for line in fileinput.input():
          vals = line.split()
          if len(vals) == 2:
            item_id, session_id = vals
            recz.add_example(item_id, session_id)
            n += 1
        recz.compact()

        print "Processed %d examples in %f seconds." % (n, clock() - start_read)
        app = tornado.web.Application([(r'/recommend', Server, dict(recz=recz)),])
        app.listen(PORT)

        print "Server ready and listening at port %d!" % PORT
        tornado.ioloop.IOLoop.instance().start()
Exemple #2
0
 def main():
     n = 0
     recz = Recz()
     for line in fileinput.input():
       vals = line.split()
       if len(vals) == 2:
         item_id, session_id = vals
         recz.add_example(item_id, session_id)
         n += 1
     recz.compact()
     recz.dump()