Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: heuristics/distillable/server.py

Issue 1808503002: Update distillability modeling scripts to predict long articles (Closed) Base URL: git@github.com:chromium/dom-distiller.git@ml-visible
Patch Set: update docs Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « heuristics/distillable/get_screenshots.py ('k') | heuristics/distillable/write_features_csv.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import argparse 6 import argparse
7 import collections 7 import collections
8 import cherrypy 8 import cherrypy
9 import json 9 import json
10 import os 10 import os
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 response = self.update(request['data']) 175 response = self.update(request['data'])
176 return json.dumps({'response': response}) 176 return json.dumps({'response': response})
177 177
178 def getLastUpdateId(self): 178 def getLastUpdateId(self):
179 return self.nextUpdateId - 1 179 return self.nextUpdateId - 1
180 180
181 181
182 182
183 if __name__ == '__main__': 183 if __name__ == '__main__':
184 parser = argparse.ArgumentParser() 184 parser = argparse.ArgumentParser()
185 parser.add_argument('--data-dir') 185 parser.add_argument('--data-dir', required=True)
186 options = parser.parse_args() 186 options = parser.parse_args()
187 service = Service(options.data_dir) 187 service = Service(options.data_dir)
188 conf = { 188 conf = {
189 'global': { 189 'global': {
190 'server.socket_host': '0.0.0.0', 190 'server.socket_host': '0.0.0.0',
191 'server.socket_port': 8081, 191 'server.socket_port': 8081,
192 }, 192 },
193 '/': { 193 '/': {
194 'tools.response_headers.on': True, 194 'tools.response_headers.on': True,
195 'tools.response_headers.headers': [('Content-Type', 'text/plain')], 195 'tools.response_headers.headers': [('Content-Type', 'text/plain')],
196 'tools.staticdir.on': True, 196 'tools.staticdir.on': True,
197 'tools.staticdir.dir': os.getcwd(), 197 'tools.staticdir.dir': os.getcwd(),
198 'tools.staticdir.index': 'index.html', 198 'tools.staticdir.index': 'index.html',
199 }, 199 },
200 '/images': { 200 '/images': {
201 'tools.staticdir.on': True, 201 'tools.staticdir.on': True,
202 'tools.staticdir.dir': os.path.join(os.getcwd(), options.data_dir), 202 'tools.staticdir.dir': os.path.join(os.getcwd(), options.data_dir),
203 'tools.expires.on': True, 203 'tools.expires.on': True,
204 'tools.expires.secs': 60, 204 'tools.expires.secs': 60,
205 } 205 }
206 } 206 }
207 cherrypy.quickstart(service, '', conf) 207 cherrypy.quickstart(service, '', conf)
OLDNEW
« no previous file with comments | « heuristics/distillable/get_screenshots.py ('k') | heuristics/distillable/write_features_csv.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698