Build a Machine Learning API with Django (3 of 6) | Django Rest Framework API Development

Поделиться
HTML-код
  • Опубликовано: 5 сен 2024

Комментарии • 110

  • @SATSifaction
    @SATSifaction  5 лет назад +4

    If you want to see the development from the start then watch this playlist 👉 ruclips.net/p/PLM30lSIwxWOivNtja1_ztft1S_vrMyA0z

    • @bossmad8265
      @bossmad8265 2 года назад +2

      what the f is this tut. you did not explain it properly. there are alot of confusions. your github also does not contain even the minim code except your private heroku deployed one

    • @SATSifaction
      @SATSifaction  2 года назад

      @@bossmad8265 they are certainly not everybody, good luck learning the concept from another channel.

  • @mrx4882
    @mrx4882 4 года назад +5

    If you are getting the error My 'MyAPI' is not defined try to install the same versions in requirements files. so use the two commands:
    pip freeze >> requirements.txt
    pip install -r requirements.txt
    Then in your URLs, if this still not working change the path to path('MyAPI/', include('MyAPI.urls'))
    and don't forget to register your model in admin.py.

  • @theanonymoustalk
    @theanonymoustalk 4 года назад +3

    at 14:46, idk if any of u guys had an error that it couldn't find ur app (his MyApi), but basically to fix it u just add ", include" right after path... so it looks like this "from django.urls import path, include" and then change the path to ur app to path('api/', include('MyApi.urls')) ; like i said idk if it relevant for anyone else but it wouldnt let me migrate until i did that

    • @achalmukaty6673
      @achalmukaty6673 3 года назад

      The error are all gone. But when I open the server in browser it says 'Page not Found'

  • @achrafbouzekri709
    @achrafbouzekri709 3 года назад

    Those asking for scaler.pkl, this how i did it:
    import joblib
    joblib.dump(sc, 'scaler.pkl') # for saving
    sc = joblib.load('scaler.pkl') # for loading

  • @shpazhist
    @shpazhist 5 лет назад +3

    Wow man! This course is an absolute gold!
    And for someone like me, a self taught SWD and who also taken courses on ML/NN/Keras etc and just deployed Django website for my gf haha and did another Real Estate Django website lol... So was just trying to figure how to go about connecting these both now and your videos came up!!!! OMG you’re my angel lololol Absolutely mind blowing practical stuff and really hope it would help me to create me my start up that I wanted to build now for so so so loooooonnnnggg lol

    • @SATSifaction
      @SATSifaction  5 лет назад

      Awesome glad it helps

    • @nurullahsirca8819
      @nurullahsirca8819 3 года назад

      Hello, did you build deployment with this tutorial? I couldn't understand how to write some of the coding parts. Woulf you mind if you share?

  • @juanbetancourt5106
    @juanbetancourt5106 4 года назад +2

    Wow, this is great, thanks a lot!

  • @saurabhrb440
    @saurabhrb440 4 года назад

    You made a jump at "25:52", and that's why majority of people are facing the error of no module named MyAPI.forms

  • @akashbhowmick6853
    @akashbhowmick6853 5 лет назад +2

    Can you please link the video of the tutorial where you explained the machine learning model tutorial

    • @SATSifaction
      @SATSifaction  5 лет назад

      Sure follow this play list. It starts with the ML model.
      ruclips.net/p/PLM30lSIwxWOivNtja1_ztft1S_vrMyA0z

  • @brendachirata2283
    @brendachirata2283 4 года назад +2

    Hello. New subbie here, thank you What if my data that im working with is very big. How do i load a text file of size 1.5G into postman for prediction?

  • @dsomethingvyea4844
    @dsomethingvyea4844 4 года назад +1

    First of all, this is a excellent video!
    I have a couple questions if you could answer please. You placed all your machine learning code in the views file. Is this where I would put it in a Production environment, or is there a better practice to place it somewhere else?
    My thinking was to somehow place the ML code in the models file. I was thinking of trying to update my DB with the ML results and then have the models.py file be able to pull it. Is that possible?
    You mentioned how you would probably clean it up the views file later. The git code looks the same as this video so just curious if you have the cleaned up code aswell?

    • @AnasLahrech
      @AnasLahrech 3 года назад

      You could create a Module (folder) called Utils within your projects and load your models, scalers, etc there. Therefore, you can call them from your views.

  • @rakeshmanathana
    @rakeshmanathana 3 года назад

    Is this the right way to load machine learning models in the view?

  • @joonauutela581
    @joonauutela581 5 лет назад

    So for the scalers-variable in approvereject you just pickle the instance of MinMaxScaler()? Awesome videos. Looking forward for future content.

    • @SATSifaction
      @SATSifaction  5 лет назад

      Yeah so any new values can get the same weight as the existing model. Thanks glad you enjoyed it

  • @yokenadinata
    @yokenadinata 4 года назад

    Hello! , i got this error ""Found array with 0 feature(s) (shape=(1, 0)) while a minimum of 1 is required." while running 'POST' on Postman with this url : 127.0.0.1:8000/status/ . what must i do now ?

  • @neeharreddy2197
    @neeharreddy2197 2 года назад

    Hello, does anyone know how to convert the input data using OneHotEncoding??

  • @nedu47
    @nedu47 4 года назад

    Please, which variable did you use to create the all_col.pkl? Thank you.

  • @lalalafamille
    @lalalafamille 3 года назад

    Very interesting video. The transition with Django, with which I am comfortable was not successful. Maybe a newer version of pickle is in cause..., I keep getting the error module '__main__' has no attribute 'unpack' when using joblib.load('loan_model.pkl)_... I can't find a way to go around this bog... If you had any suggestions, I would appreciate...

    • @SATSifaction
      @SATSifaction  3 года назад +1

      This video was made using TF 1. I know some users were having issues with TF2. What version do you have?

  • @rosamendrofa8173
    @rosamendrofa8173 4 года назад

    Hallo, i want to ask about scaler.pkl. what the scalers function and how can i get it save to pickle in python? thank you

  • @salarghaffarian4914
    @salarghaffarian4914 4 года назад

    Hi, I am trying to make a website that is able to use CNNs ( a deep learning network) on the back-end. And get the uploaded images from the user and do a segmentation of the uploaded image and share the segmentation results by sending a download link with the user.
    I know deep learning methods and its programming in python by using the frameworks like Pytorch and Tensorflow. But I do not know what to do next. Is django framework sufficient to make this happen? If not, could you please guide me about the required steps that I need to take to create such a website?
    Thanks for in advance!

  • @tickozz
    @tickozz 4 года назад +1

    the endpoint is just doing inference right? so no GPU needed? what happens if u use it to do training with GPU. will it be able to handle multiple requests?

    • @SATSifaction
      @SATSifaction  4 года назад

      If I understand your question, you want the end point to initiate training? If that’s the case that would chew up unnecessary compute power and also indicate that every request to the end point would lead to a substantial difference in end result. If that’s the case I’m not sure you have a stable model. Id run the model on new data on a predetermined cadence and use the API to tap into that algorithm. One reason I can think of doing what I believe you suggested is for facial recognition but outside of that it doesn’t sound feasible for this use case

    • @tickozz
      @tickozz 4 года назад

      @@SATSifaction currently, I'm working on a project that calls a deepfake detection API that I had build which uses GPU. So I'm quite unsure what happens if I try to process multiple requests at the same time. How should I go about throttling the incoming requests or how do I ensure that my GPU does not run out of memory when it process the incoming request,

    • @nguyenson1177
      @nguyenson1177 3 года назад

      @@tickozz I would love to see your project, can I have a link to it?

  • @suppro3602
    @suppro3602 4 года назад +2

    NameError: name 'MyAPI' is not defined I can't resolve this error

    • @padminidevnerrenu5604
      @padminidevnerrenu5604 4 года назад

      Hello, i am also getting the same error , @SATSifaction ,I greatly appreciate if u could help as why is this error?

    • @harshithkumarpedarla6233
      @harshithkumarpedarla6233 4 года назад +1

      @@padminidevnerrenu5604 guys even i'm facing same issue someone please help us out

    • @abhishekporwal9540
      @abhishekporwal9540 4 года назад

      Same isuue

  • @emirhankenter5848
    @emirhankenter5848 4 года назад +1

    MyAPI box doesn't appear on the Django administration page. I have done all correct. Can you please help me to solve that.

    • @SATSifaction
      @SATSifaction  4 года назад +2

      You need to make sure you activate it in the admin settings. It’s covered off in the video. Small step that some miss

    • @ghaithbenamor2788
      @ghaithbenamor2788 4 года назад

      @Shreepad Khandve Thank you man

  • @pranjal1100
    @pranjal1100 4 года назад

    After loading the model using joblibs , the runserver throws a "No module named Tensorflow/keras". Do I have to install all the software dependencies again in the venv just to use a trained model?

  • @zhongxiaotao1837
    @zhongxiaotao1837 3 года назад

    clear, nice

  • @mayanktripathi4u
    @mayanktripathi4u 4 года назад

    Seems we have not cretaed pickle file "scalers.pkl", in any of the past videos. Could you please let know, if i need to create a pickle file for scalers then it will be as below??
    X = sc.fit_transform(X1)
    scalerfilename = 'scalers.pkl'
    joblib.dump(X, scalerfilename)

    • @SATSifaction
      @SATSifaction  4 года назад

      You need to create it or use the one on GitHub. I didn’t show the scalers as I wanted the user to learn and create it.

  • @RAVIPRAKASH-ks5kw
    @RAVIPRAKASH-ks5kw 4 года назад +2

    I am stuck on the part when we complete the models.py and run the server. I copied everything as you told. But, when I run it, it says
    NameError: name 'MyAPI' is not defined
    Please help.
    Also, I checked the github issues but it was of no use. I even intsalled the exact same versions as you used by pip install django==2.2.4 etc.
    Please guide me

    • @SATSifaction
      @SATSifaction  4 года назад

      That tells me you don’t have the right folder structure. How is your structure setup?

    • @RAVIPRAKASH-ks5kw
      @RAVIPRAKASH-ks5kw 4 года назад

      @@SATSifaction Exactly as shown in the video

    • @RAVIPRAKASH-ks5kw
      @RAVIPRAKASH-ks5kw 4 года назад

      AttributeError: module 'MyAPI.views' has no attribute 'myform'

    • @janvichokshi4892
      @janvichokshi4892 3 года назад

      I'm also stuck at this

    • @achalmukaty6673
      @achalmukaty6673 3 года назад

      I am also stuck here

  • @mcan543
    @mcan543 4 года назад

    #Django #keyTakeAways for me from this video.
    25:45
    27:00 router urls in API

  • @gautamj7450
    @gautamj7450 4 года назад

    Anyone tried doing the API Handling using class-based views instead of the shown functional view? I always prefer class-based views, but in this case, I'm not able to figure out how to make it work. Help would be much appreciated. :)

  • @JohnDoe-ji1zv
    @JohnDoe-ji1zv 4 года назад

    @SATSifaction how did you actually scaled the model and exported to pkl ? Could you paste a sample code here pls

  • @HemantKumar-iy7dn
    @HemantKumar-iy7dn 4 года назад +1

    How you managed to do one hot encoding on user data(didn't see code for that) i mean how to save that instance of one hot

    • @SATSifaction
      @SATSifaction  4 года назад

      Check out the first video in the series I believe what you are asking is covered there

    • @HemantKumar-iy7dn
      @HemantKumar-iy7dn 4 года назад

      i mean i can do one hot using get_dummies but its instance cannot be saved while deploying so did you used scikit learn keras something like that for one hot in deployment phase

    • @SATSifaction
      @SATSifaction  4 года назад

      You can actually save it by Pickleing the model

  • @imrans.m6788
    @imrans.m6788 4 года назад

    Thank you so much 😊

  • @dgiri2333
    @dgiri2333 2 года назад

    Your Model.py and Views.py submited Form Data not utilized on Mechine Leaving API POST Call at all ,API Decarator input and Model Prediction only process input and Giving output no relation happen api and Model

    • @SATSifaction
      @SATSifaction  2 года назад

      Watch the full series. The result is based on a backend ML model

  • @juyeesabade6236
    @juyeesabade6236 4 года назад

    I got a AttributeError at /status/
    predict not found error in Postman. What is the solution for this?

  • @harshitharaj6725
    @harshitharaj6725 4 года назад

    AttributeError: module 'BankMlApp' has no attribute 'urls'
    while executing i am getting this error the same way i followed to u had followed

    • @SATSifaction
      @SATSifaction  4 года назад

      Please ensure you are running this in a virtual environment and using the requirements.txt file

  • @richiearnoldr1187
    @richiearnoldr1187 4 года назад

    where is the .csv file called?

  • @luckyrathod8153
    @luckyrathod8153 4 года назад

    How can i pass multiple inputs white testing.(If i want to test for 5 ids .Then how should i pass 5 inputs and for each I'd .How predict () will be modified). So that prediction will be array of 5 id's

    • @SATSifaction
      @SATSifaction  4 года назад +1

      You would need to loop through the machine learning model with the ids in a dictionary which isn’t hard to do, it will just take a few min longer. However on the Django end that means a design change in the actual way output is displayed. Right now it’s displayed as a single user but if you want it to show multiple ids then you would need to build a for loop on the django HTML page (likely using ginga) and then decide how you want the front end to look like. Hope that helps

    • @luckyrathod8153
      @luckyrathod8153 4 года назад

      If there are 100 ids then is for loop an optimum solution .

    • @SATSifaction
      @SATSifaction  4 года назад +1

      For the machine learning side if the model is pickled or you use checkpoints, 100 ids should be no problem with a for loop. The Django side will need more modifications

    • @luckyrathod8153
      @luckyrathod8153 4 года назад

      Can you please help me with an example

    • @SATSifaction
      @SATSifaction  4 года назад +1

      Wouldn’t be here but I can put it on my list of videos to do.

  • @usamauet
    @usamauet 4 года назад

    I am also getting this error "NameError: name 'MyAPI' is not defined" and if i try to run your code. It was requesting for username and password that was not known to me

    • @bishrutneupane649
      @bishrutneupane649 4 года назад

      Have you defined MyApi in Installed Apps of Setting.py check or IN urls.py check

    • @usamauet
      @usamauet 4 года назад

      @@bishrutneupane649 I define MyAPI in setting.py and also in urls.py

    • @stifenjans4342
      @stifenjans4342 4 года назад

      @@usamauet are u winning yet with that error 'MyAPI' not define dawg?

    • @stifenjans4342
      @stifenjans4342 4 года назад

      @@usamauet
      'DjangoAPI/urls.py' :
      from django.contrib import admin
      from django.urls import path, include
      urlpatterns = [
      path('admin/', admin.site.urls),
      path(' ', include('MyAPI.urls')),
      ]
      " " " make sure ur 'urls.py' in 'Djangoapi' look like this
      " " "
      'MyAPI/urls.py' :
      from django.urls import path
      urlpattern[
      ]
      " " " just leave urlpattern in MyAPI empty at testing
      " " "

  • @aniksinha2081
    @aniksinha2081 4 года назад

    It is showing no module hwo to resolve it

    • @SATSifaction
      @SATSifaction  4 года назад

      Try using a virtual environment and use the supplies requirements.txt

  • @dimasandhikasury6128
    @dimasandhikasury6128 4 года назад

    How you make allcol.pkl, please got it completely

  • @ghaithbenamor2788
    @ghaithbenamor2788 4 года назад

    I got this error on postman !!!!!!!
    ModuleNotFoundError at /status/
    No module named 'keras

  • @mrutyunjayashiremath5589
    @mrutyunjayashiremath5589 4 года назад

    Sir I've completed machine learning can I learning Django ????

    • @SATSifaction
      @SATSifaction  4 года назад

      Sure there should be nothing stopping you from learning either of them independently

  • @sudhanshukumar5965
    @sudhanshukumar5965 4 года назад +5

    Dude, you made a great tutorial but couldn't you have just gone stepwise when the actual implementation of the machine learning model was going? That would have been great for someone new in django and machine learning. Everything went smooth and suddenly you show all the code copy pasted already ....WTF

    • @SATSifaction
      @SATSifaction  4 года назад +3

      Thank you. If I spent the time to write everything out it would really take a long time. I want the users to be able to read code as well which is why I mix between the two.

  • @jakkrits2086
    @jakkrits2086 4 года назад

    What screen drawing app you use on macOS? ruclips.net/video/dJihgq_4gNg/видео.html

  • @asmakhalidbutt6830
    @asmakhalidbutt6830 4 года назад

    what is the code of scalers.pkl file??

    • @SATSifaction
      @SATSifaction  4 года назад

      It’s not a code. It’s a scaler file that is created. Video 2 shows you how to create it

    • @asmakhalidbutt6830
      @asmakhalidbutt6830 4 года назад

      @@SATSifaction I have seen video2, but you only create "loan_model.pkl" file. You did not create "scaler.pkl" file

    • @SATSifaction
      @SATSifaction  4 года назад

      Apologies you are correct. However to create the scalers is the same as creating the model. When you scale the model you would store the .fit method to a pickle module.

    • @namanmehra8097
      @namanmehra8097 4 года назад +1

      @@SATSifaction so the file u made in video 2 is scaler.pkl ?
      isn't it ?

  • @kimatibula3096
    @kimatibula3096 5 лет назад

    Nice :)

  • @nishanpaudel3960
    @nishanpaudel3960 3 года назад

    Bit confusing, mate you have jumped from one concept to another out of nowhere. Your first two videos were excellent, this one not so great, even someone with Django knowledge will have hard time figuring it out

  • @uzochukwuuruakpa4100
    @uzochukwuuruakpa4100 4 года назад

    got this error when working on the views: from . forms import ModelForm
    ModuleNotFoundError: No module named 'my_api.forms'

    • @SATSifaction
      @SATSifaction  4 года назад

      Make sure you’re using the requirements.txt....also pls always check stackoverflow and other google sources

  • @suppro3602
    @suppro3602 4 года назад

    NameError: name 'MyAPI' is not defined I can't resolve this error

    • @stifenjans4342
      @stifenjans4342 4 года назад

      @Sup pro, are u winning yet with that error?

    • @stifenjans4342
      @stifenjans4342 4 года назад

      ruclips.net/video/yD0_1DPmfKM/видео.html, here some link, that may fix 'MyAPI' with exception only if u follow along this link first then u edit it bit like this SAT tutorials, at least that working for me stuck at same case myapi didn't recognize