master
/ .ipynb_checkpoints / main-checkpoint.ipynb

main-checkpoint.ipynb @6135863view markup · raw · history · blame

Notebook
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)
/home/jovyan/work
07:26:17 INFO:best_model: /home/jovyan/work/results/output_poem/best_model/model-20390

result:
大妃非是列,志事满黄枢。始喜封阳礼,开摩舞罢歌。
In [ ]: