Machine Learning Deployment using Flask
2022-08-24
8주차 : Machine Learning Deployment using Flask
- Study: REST API with Flask
- Deploying a Machine Learning Model with REST API Flask (모델 배포)
- Please read this following article: link
- Deploy a machine learning model using flask (with rest api)
- Please follow the steps in the above-mentioned article and run on your local computer !
- Additional Task:
- On the article, they used RandomForestRegressor as classifier, please change it with another type of classifier !
- You can choose the classifiers freely, e.g., linear model, decision tree, support vector machine, etc.
- (optional) Please make a simple UI for this project (similar with the last week task)
# creating model from sklearn.ensemble import RandomForestRegressor classifier = RandomForestRegressor() classifier.fit(X_train, y_train)
- On the article, they used RandomForestRegressor as classifier, please change it with another type of classifier !
- Deploying the project on the server
- Instead run the project on your local computer, you can deploy the project on server so other members can access your work
- You might choose the server based on your preferences (e.g., Heroku, etc) give us any recommendations !
- Share your works with others ^^
- Try with other projects
- You can try with other problems/projects
- For your references (choose one of them):
- https://wikidocs.net/143898
- https://niceman.tistory.com/192
- https://github.com/akashdeepjassal/mnist-flask
- Digital covid detection: link
세팅중 에러
File "./app.py", line 3, in <module>
from flask_restx import Resource, Api # Api 구현을 위한 Api 객체 import
File "/usr/local/lib/python3.8/site-packages/flask_restx/__init__.py", line 5, in <module>
from .api import Api # noqa
File "/usr/local/lib/python3.8/site-packages/flask_restx/api.py", line 50, in <module>
from .swagger import Swagger
File "/usr/local/lib/python3.8/site-packages/flask_restx/swagger.py", line 18, in <module>
from werkzeug.routing import parse_rule
ImportError: cannot import name 'parse_rule' from 'werkzeug.routing' (/usr/local/lib/python3.8/site-packages/werkzeug/routing/__init__.py)
stackoverflow Answers
The solution (workaround) was that I additionally included werkzeug in the version 2.1.2 in the requirements.txt
werkzeug==2.1.2
azure 데이터 베이스 연결 에러
UserWarning: pandas only support SQLAlchemy connectable(engine/connection) ordatabase string URI or sqlite3 DBAPI2 connectionother DBAPI2 objects are not tested, please consider using SQLAlchemy