from yi import YiProgram
def handle(conf):
"""
该方法是部署之后,其他人调用你的服务时候的处理方法。
请按规范填写参数结构,这样我们就能替你自动生成配置文件,方便其他人的调用。
范例:
params['key'] = value # value_type: str # description: some description
value_type 可以选择:img, video, audio, str, int, float, [int], [str], [float]
参数请放到params字典中,我们会自动解析该变量。
"""
# get the input params
wish = conf['wish'] # value_type: str # description: some description
pray = conf['pray']
# predict
obj = YiProgram()
origin_hexagram, support_hexagram, turn_symbol_desc, main_indicate, support_indicate = obj.predict(wish, pray)
# return results
return dict(
origin_hexagram=origin_hexagram,
support_hexagram=origin_hexagram,
turn_symbol_desc=turn_symbol_desc,
main_indicate=main_indicate,
support_indicate=support_indicate
)
if __name__ == '__main__':
wish = '希望'
pray = '祈祷'
conf = dict(wish=wish, pray=pray)
results = handle(conf)
print('results:\n', results)