python:3.x
tensorflow 1.x
缺少库 word2vec
使用
$conda install word2vec
运行写诗服务:
$python poem_server
windows
python poem_server.py
此步需要先运行训练产生好模型后。
---
if poem_style == 1:
return writer.free_verse()
elif poem_style == 2:
return writer.rhyme_verse()
if start_with:
if poem_style == 3:
return writer.cangtou(start_with)
elif poem_style == 4:
return writer.hide_words(start_with)
http://127.0.0.1:5000/poem?style=1 # 自由写诗
http://127.0.0.1:5000/poem?style=2 # 押韵写诗
http://127.0.0.1:5000/poem?style=3&start= # 藏头写诗
http://127.0.0.1:5000/poem?style=4&start= # 隐字写诗(藏头中的一个字 押韵写诗)
如有问题欢迎讨论 xiuyunchen@126.com