本文整理匯總了Python中yhat.Yhat.deploy_to_file方法的典型用法代碼示例。如果您正苦於以下問題:Python Yhat.deploy_to_file方法的具體用法?Python Yhat.deploy_to_file怎麽用?Python Yhat.deploy_to_file使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類yhat.Yhat
的用法示例。
在下文中一共展示了Yhat.deploy_to_file方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: hello
# 需要導入模塊: from yhat import Yhat [as 別名]
# 或者: from yhat.Yhat import deploy_to_file [as 別名]
{"name": "x", "na_filler": 0},
{"name": "z", "na_filler": fill_z}
]
class MyOtherClass:
def hello(self, x):
return "hello: %s" % str(x)
REQS = open("reqs.txt").read()
### <DEPLOYMENT START> ###
# @preprocess(in_type=dict, out_type=pd.DataFrame, null_handler=features)
class MyModel(YhatModel):
REQUIREMENTS=REQS
@preprocess(out_type=pd.DataFrame)
def execute(self, data):
return predict(data)
# "push" to server would be here
data = {"x": 1, "z": None}
if __name__ == '__main__':
creds = credentials.read()
yh = Yhat(creds['username'], creds['apikey'])
yh.deploy_to_file("mynewmodel", MyModel, globals())
示例2: goodbye
# 需要導入模塊: from yhat import Yhat [as 別名]
# 或者: from yhat.Yhat import deploy_to_file [as 別名]
from yhat import YhatModel, Yhat, preprocess
# from first import hello as h2
import first as f2
from first import Support
from another.testfile import bye
def goodbye(y):
bye()
print y, "goodbye!"
class Example(YhatModel):
@preprocess(in_type=dict, out_type=dict)
def execute(self, data):
goodbye(x)
return Support().hello(10)
# return h2(data)
from first import x
yh = Yhat("greg", "fCVZiLJhS95cnxOrsp5e2VSkk0GfypZqeRCntTD1nHA", "http://api.yhathq.com/")
yh.deploy_to_file("Example", Example, globals())