2ee792e
yangsaisai 7 years ago
3 changed file(s) with 95 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
0 # coding = utf-8
1 # You can use other public modules via our Client object with module's identifier
2 # and parameters.
3 # For more detailes, please see our online document - https://momodel.github.io/docs/#
4
0 # coding: utf-8
51 import os
62 import sys
73
8
4 # sys.path.append('../')
95 # Import necessary packages
10 from modules import json_parser
6 # from modules import json_parser
117 from modules import Client
12
138 from write_poem import start_model
149
1510 # Initialise Client object
4237
4338
4439 # if __name__ == '__main__':
45 # conf = {}
46 # handle(conf)
40 # conf = {"style": ['藏头诗'], "Chinese_word": '杨赛赛'}
41 # aa = handle(conf)
42 # print(aa)
33 "cell_type": "code",
44 "execution_count": 1,
55 "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 ],
719 "source": [
820 "# coding = utf8\n",
921 "# You can use other public modules via our Client object with module's identifier\n",
3446 "controller = client.controller\n",
3547 "\n"
3648 ]
49 },
50 {
51 "cell_type": "code",
52 "execution_count": null,
53 "metadata": {},
54 "outputs": [],
55 "source": []
3756 },
3857 {
3958 "cell_type": "code",
82101 },
83102 {
84103 "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",
85167 "execution_count": null,
86168 "metadata": {},
87169 "outputs": [],
0 # coding = utf-8
1 # You can use other public modules via our Client object with module's identifier
2 # and parameters.
3 # For more detailes, please see our online document - https://momodel.github.io/docs/#
4
0 # coding: utf-8
51 import os
62 import sys
73
8
4 # sys.path.append('../')
95 # Import necessary packages
10 from modules import json_parser
6 # from modules import json_parser
117 from modules import Client
12
138 from write_poem import start_model
149
1510 # Initialise Client object
4237
4338
4439 # if __name__ == '__main__':
45 # conf = {}
46 # handle(conf)
40 # conf = {"style": ['藏头诗'], "Chinese_word": '杨赛赛'}
41 # aa = handle(conf)
42 # print(aa)