E
E
Evgeny_A2021-03-25 13:15:21
Django
Evgeny_A, 2021-03-25 13:15:21

How can I run a model in the background so that I can refer to it later?

Greetings!

I have a regular virtual machine in the cloud under Linux and an ML model that I load using keras.load_model('path/to/model'). I need to make a web service that receives the user's picture, processes it in a Keras model, and returns the response to the page. All the tutorials I found either load the model in view.py and do it on every HTTP request, or create complex schemas with changes in parts of projects outside of the specific application.

I need to:

  1. Keras model was loaded only once at Apache server startup
  2. The integration was within a specific Django application
  3. Ability to access the model from any other Django application


Tried loading model in Django Cache, tried loading it via Custom App Config in apps.py file, tried loading model in virws.py

The solution must meet all three conditions at the same time. Please tell me possible implementation options.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2021-03-25
@bacon

Move the model into a separate independent service, access it, for example, via http, socket, or any other method convenient for you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question