I need to implement a Django RESTful service where I can run an algorithm and get the result.
On the server I need to have a CSV file with the records for the algorithm. A service, let's say /train
will allow me to train a Random Forest with the data in the CSV file, and finally another service /predict
will receive the parameters and send me the result. The problem is that I have this running as a script on my computer and I don't know how to structure it for a web application.
I have already done RESTful APIs in Django but this problem is different I think.
My idea is to send a GET request to /predict
with the parameters needed for the Random Forest and return the algorithm result.
Any suggestions? Or a public repo with a similar problem?
let say you have
train_view
for '/train' with POST request.
result_view
for /predict
with GET request
Do you need models ?
I think you need that since in request /predict
you are going to apply logic on the data you have given in request /train
, so create model.
Do you need serializers
Since you have model, you can write modelserializer
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.