7
Charon92
70d

To all the Python devs on here, I have a question!

So I'm building a Chatbot, I've set up a basic NLP backend and I'm looking for the best method to have the actual "app" interact with the backend.

I'm thinking, have the actual bit as a Django app (because I'd like to integrate it into Django sites later on) and then run the actual NLP bit on a Flask app then just use it as an API.

Can you think if any obvious downsides to this besides the bit of network latency?

Comments
  • 4
    Why not use nlp with celery and call it from django ?
  • 2
    @vane

    I had... Not even thought of that.
  • 1
    @Charon92 clearly you want to separate asynchronous task which is nlp from synchronous wsgi web framework, the common way to do it is use queue - now depends on what functionality you want from your queue, celery gives you access to certain queue backends.

    Well that’s common way of doing those things in python.

    Think about distribution of responsibilities and how it behaves asynchronous.
    Good luck 🍀
  • 1
    @vane

    You sir, are fucking majestic and I thank you for your sage advice.

    Onto setting up Celery and getting everything communicating!
  • 1
    @Charon92 If I may suggest something setup docker and docker-compose

    then docker-compose up
    your environment with celery and desired backend, expose port, mount volumes well it’s hard on the beginning to get used to this way of work but then you appreciate the time you got back by not reinventing the wheel by installing shit over and over

    it would be more portable and upgradeable.
  • 1
    @vane

    That actually works perfectly. The frontend and Django app already run on docker so I can just chuck them all together and compose it up.

    GENIUS!

    I totally forgot about that. Plus it'll mean I can keep it all under one project in PyCharm too!
  • 0
    @Charon92 Glad I could help You.
    What nlp library you’re using ?
  • 0
    @vane

    NLTK and Sklearn.

    I thought about trying to find something more all inclusive but I'm basically using this project to learn so figured I'd start with the basics and work my way up.
  • 1
Your Job Suck?
Get a Better Job
Add Comment