Handling multiple trained pipeline packages #7377
paulbriton
started this conversation in
Help: Best practices
Replies: 1 comment 1 reply
-
If you actually want to conditionally load the model, I would recommend the first pattern because it's structurally simpler. The second one requires you to type the same information repeatedly, and can more readily cause typos, like the one in your example. That said, loading a model per request is probably going to be really slow. What I would do for a multi-lingual web application, assuming you can fit multiple models in memory, is load the models and keep them around to re-use across requests. Something like this:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I'm looking for the most pythonic/recommended way to handle multiple languages with spaCy on a fastAPI application. I would like to send a request to the API containing the ISO code of the language and conditionally load the corresponding model.
So far here are the two solutions I've found:
Is there a better one? What do you recommend?
Beta Was this translation helpful? Give feedback.
All reactions