Skip to content

Commit

Permalink
add log
Browse files Browse the repository at this point in the history
  • Loading branch information
wb14123 committed Nov 4, 2017
1 parent 4b2832e commit 2624f0a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
from flask_cors import CORS, cross_origin
from model import Model
from gevent.wsgi import WSGIServer
import logging

app = Flask(__name__)
CORS(app)

vocab_file = '/data/dl-data/couplet/vocabs'
model_dir = '/data/dl-data/models/tf-lib/output_couplet'
model_dir = '/data/dl-data/models/tf-lib/output_couplet_prod'

m = Model(
None, None, None, None, vocab_file,
Expand All @@ -20,11 +21,12 @@

@app.route('/chat/couplet/<in_str>')
def chat_couplet(in_str):
if len(in_str) == 0 or len(in_str) > 20:
if len(in_str) == 0 or len(in_str) > 50:
output = u'您的输入太长了'
else:
output = m.infer(' '.join(in_str))
output = ''.join(output.split(' '))
print('上联:%s;下联:%s' % (in_str, output))
return jsonify({'output': output})


Expand Down

0 comments on commit 2624f0a

Please sign in to comment.