| 3 | 3 |
"cell_type": "code",
|
| 4 | 4 |
"execution_count": 1,
|
| 5 | 5 |
"metadata": {},
|
| 6 | |
"outputs": [],
|
|
6 |
"outputs": [
|
|
7 |
{
|
|
8 |
"ename": "ImportError",
|
|
9 |
"evalue": "No module named 'modules'",
|
|
10 |
"output_type": "error",
|
|
11 |
"traceback": [
|
|
12 |
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
|
13 |
"\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
|
|
14 |
"\u001b[0;32m<ipython-input-1-b6ce2ceab38e>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 12\u001b[0m \u001b[0;31m# Import necessary packages\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 13\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mmodules\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mjson_parser\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 14\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmodules\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mClient\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 15\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
|
|
15 |
"\u001b[0;31mImportError\u001b[0m: No module named 'modules'"
|
|
16 |
]
|
|
17 |
}
|
|
18 |
],
|
| 7 | 19 |
"source": [
|
| 8 | 20 |
"# coding = utf8\n",
|
| 9 | 21 |
"# You can use other public modules via our Client object with module's identifier\n",
|
|
| 34 | 46 |
"controller = client.controller\n",
|
| 35 | 47 |
"\n"
|
| 36 | 48 |
]
|
|
49 |
},
|
|
50 |
{
|
|
51 |
"cell_type": "code",
|
|
52 |
"execution_count": null,
|
|
53 |
"metadata": {},
|
|
54 |
"outputs": [],
|
|
55 |
"source": []
|
| 37 | 56 |
},
|
| 38 | 57 |
{
|
| 39 | 58 |
"cell_type": "code",
|
|
| 82 | 101 |
},
|
| 83 | 102 |
{
|
| 84 | 103 |
"cell_type": "code",
|
|
104 |
"execution_count": 2,
|
|
105 |
"metadata": {},
|
|
106 |
"outputs": [
|
|
107 |
{
|
|
108 |
"ename": "ImportError",
|
|
109 |
"evalue": "No module named 'modules'",
|
|
110 |
"output_type": "error",
|
|
111 |
"traceback": [
|
|
112 |
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
|
113 |
"\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
|
|
114 |
"\u001b[0;32m<ipython-input-2-3bc0b5b2f564>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;31m# Import necessary packages\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;31m# from modules import json_parser\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mmodules\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mClient\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mwrite_poem\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mstart_model\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
|
115 |
"\u001b[0;31mImportError\u001b[0m: No module named 'modules'"
|
|
116 |
]
|
|
117 |
}
|
|
118 |
],
|
|
119 |
"source": [
|
|
120 |
"# coding: utf-8\n",
|
|
121 |
"import os\n",
|
|
122 |
"import sys\n",
|
|
123 |
"\n",
|
|
124 |
"# Import necessary packages\n",
|
|
125 |
"# from modules import json_parser\n",
|
|
126 |
"from modules import Client\n",
|
|
127 |
"\n",
|
|
128 |
"from write_poem import start_model\n",
|
|
129 |
"\n",
|
|
130 |
"# Initialise Client object\n",
|
|
131 |
"client = Client(api_key='33799e1c5d6fa05fdd7dec3aa7aad868445d1c737edcf9c37fa89cb3b39cb2d9',\n",
|
|
132 |
" project_id='5bfd118f1afd942b66b36b30', user_ID='yangsaisai',\n",
|
|
133 |
" project_type='app', source_file_path='main.py', \n",
|
|
134 |
" silent=True)\n",
|
|
135 |
"\n",
|
|
136 |
"# Make run/train/predict command alias for further use\n",
|
|
137 |
"run = client.run\n",
|
|
138 |
"train = client.train\n",
|
|
139 |
"predict = client.predict\n",
|
|
140 |
"\n",
|
|
141 |
"# Make controller alias for further use\n",
|
|
142 |
"controller = client.controller\n",
|
|
143 |
"writer = start_model()\n",
|
|
144 |
"\n",
|
|
145 |
"\n",
|
|
146 |
"def handle(conf):\n",
|
|
147 |
" # paste your code here\n",
|
|
148 |
" # path = os.getcwd() # 获取当前工作目录\n",
|
|
149 |
" # print(path)\n",
|
|
150 |
" if conf['style'] == ['藏头诗']:\n",
|
|
151 |
" poetry = writer.cangtou(conf['Chinese_word'])\n",
|
|
152 |
" elif conf['style'] == ['藏字诗']:\n",
|
|
153 |
" poetry = writer.hide_words(conf['Chinese_word'])\n",
|
|
154 |
" else:\n",
|
|
155 |
" poetry = writer.rhyme_verse()\n",
|
|
156 |
" return {\"Poetry\": poetry}\n",
|
|
157 |
"\n",
|
|
158 |
"\n",
|
|
159 |
"# if __name__ == '__main__':\n",
|
|
160 |
"# conf = {\"style\": ['藏头诗'], \"Chinese_word\": '杨赛赛'}\n",
|
|
161 |
"# aa = handle(conf)\n",
|
|
162 |
"# print(aa)\n"
|
|
163 |
]
|
|
164 |
},
|
|
165 |
{
|
|
166 |
"cell_type": "code",
|
| 85 | 167 |
"execution_count": null,
|
| 86 | 168 |
"metadata": {},
|
| 87 | 169 |
"outputs": [],
|