[英]To Deploy my Python machine learning model as web service
I have developed a Machine learning model in anaconda prompt using Python3 so to deploy it and to run it anywhere dynamically on GitHub or as a webservice what is the way? 我已经在Python的anaconda提示符下开发了一个机器学习模型,以便部署它并在GitHub上或作为Web服务在任何地方动态运行它,这是怎么回事?
I have already used Pickle command but it didn't work for me. 我已经使用了Pickle命令,但对我不起作用。
import pickle
file_name = "cancerdetection.ipynb"
It didn't deploy my model as webservice. 它没有将我的模型部署为Web服务。
You can try using flask. 您可以尝试使用烧瓶。 It uses python and deploys as a web application.
它使用python并将其部署为Web应用程序。 Here's some sample code you can try.
这是您可以尝试的一些示例代码。
from flask import Flask, render_template, request
app = Flask(__name__, static_url_path='/static')
@app.route('/')
def upload_file():
return "hello world"
if __name__ == '__main__':
app.run(host="0.0.0.0")
By setting 通过设置
host="0.0.0.0"
主机=“ 0.0.0.0”
you're deploying your application on the net by using your local machine as a server. 您正在使用本地计算机作为服务器在网上部署应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.