- ..
- app_spec-checkpoint.yml
- char_rnn_model-checkpoint.py
- config_poem-checkpoint.py
- data_loader-checkpoint.py
- faas_requirements-checkpoint.txt
- main-checkpoint.ipynb
- main-checkpoint.py
- OVERVIEW-checkpoint.md
- poem_server-checkpoint.py
- train-checkpoint.py
- Untitled-checkpoint.ipynb
- word2vec_helper-checkpoint.py
- write_poem-checkpoint.py
main-checkpoint.ipynb @6135863 — view markup · raw · history · blame
In [1]:
# coding = utf8
# You can use other public modules via our Client object with module's identifier
# and parameters.
# For more detailes, please see our online document - https://momodel.github.io/docs/#
import os
import sys
# Define root path
sys.path.append('../')
# Import necessary packages
from modules import json_parser
from modules import Client
# Initialise Client object
client = Client(api_key='33799e1c5d6fa05fdd7dec3aa7aad868445d1c737edcf9c37fa89cb3b39cb2d9',
project_id='5bfd118f1afd942b66b36b30', user_ID='yangsaisai',
project_type='app', source_file_path='Untitled.ipynb')
# Make run/train/predict command alias for further use
run = client.run
train = client.train
predict = client.predict
# Make controller alias for further use
controller = client.controller
In [2]:
from write_poem import start_model
path = os.getcwd() # 获取当前工作目录
print(path)
writer = start_model()
def write_poem():
start_with = '大是大非开始了'
poem_style = 4
if start_with:
if poem_style == 3:
return writer.cangtou(start_with)
elif poem_style == 4:
return writer.hide_words(start_with)
if poem_style == 1:
return writer.free_verse()
elif poem_style == 2:
return writer.rhyme_verse()
if __name__ == "__main__":
result = write_poem()
print('result:')
print(result)
In [ ]: