LMonan
3 years ago
| 0 | import y1 | |
| 0 | from yi import YiProgram | |
| 1 | 1 | |
| 2 | 2 | def handle(conf): |
| 3 | 3 | """ |
| 9 | 9 | 参数请放到params字典中,我们会自动解析该变量。 |
| 10 | 10 | """ |
| 11 | 11 | |
| 12 | things = conf['things'] # value_type: str # description: some description | |
| 12 | # get the input params | |
| 13 | wish = conf['wish'] # value_type: str # description: some description | |
| 13 | 14 | pray = conf['pray'] |
| 15 | ||
| 16 | # predict | |
| 17 | obj = YiProgram() | |
| 18 | origin_hexagram, support_hexagram, turn_symbol_desc, main_indicate, support_indicate = obj.predict(wish, pray) | |
| 14 | 19 | |
| 15 | # add your code | |
| 16 | return {'ret1': 'cat'} | |
| 20 | # return results | |
| 21 | return dict( | |
| 22 | origin_hexagram=origin_hexagram, | |
| 23 | support_hexagram=origin_hexagram, | |
| 24 | turn_symbol_desc=turn_symbol_desc, | |
| 25 | main_indicate=main_indicate, | |
| 26 | support_indicate=support_indicate | |
| 27 | ) | |
| 28 | ||
| 29 | if __name__ == '__main__': | |
| 30 | wish = '希望' | |
| 31 | pray = '祈祷' | |
| 32 | conf = dict(wish=wish, pray=pray) | |
| 33 | results = handle(conf) | |
| 34 | print('results:\n', results) | |
| 17 | 35 | ⏎ |