Spacy GraphQL interface #3568
Replies: 6 comments
-
Oh cool, thanks for sharing! If you'd like to submit a PR to the spaCy Universe (source here), that'd be great. I briefly experimented with spaCy and GraphQL here (mostly to try out GraphQL and learn how it works) and it was really promising – your project seems like the more advanced version of that 😅 One thing I've been wondering: Do you know if it's possible to use the GraphQL wrapper to be smart about what pipeline components to run, depending on the query? For example, let's say the query only wants POS tags – instead of running the whole with nlp.disable_pipes(*[pipe for pipe in nlp.pipe_names if pipe != "tagger"]):
doc = nlp(text)
# and so on... It seems like this is very much in line with the GraphQL philosophy – so if something like this could work with spaCy, that'd be a really useful feature. |
Beta Was this translation helpful? Give feedback.
-
Hi Ines and thx for your comments Regarding pipelines, it is already possible with my implementation:
|
Beta Was this translation helpful? Give feedback.
-
What is missing and could be cool is:
|
Beta Was this translation helpful? Give feedback.
-
Ahh, nice, I didn't see the I don't think this will be a big issue, but if you ever wanted to reduce the models kept in memory for different combinations of disabled pipes, using My initial idea was to do this automatically on the server and basically have a function that decides which components can be safely disabled, given the query. Could be nice for larger code bases – at any given point, you could just write a query for what you need, without having to think about what pipes to disable to make it as fast as possible.
That'd be super cool, yes! 👍
The only thing to consider here is: Would you actually want your server to quietly download and install a (potentially large) model in the background while fulfilling a request? But I guess it could be useful during development. |
Beta Was this translation helpful? Give feedback.
-
Good idea, I've changed the way disable pipes is implemented to save memory. |
Beta Was this translation helpful? Give feedback.
-
Hi Ines, Olivier |
Beta Was this translation helpful? Give feedback.
-
Feature description
I have developped a tiny graphql wrapper aroung spacy using graphene and starlette.
I have found it very usefull to integrate spacy remotely with other programming languages like javascript or java/kotlin
It is available in https://github.com/oterrier/gracyql
A kotlin client is available in https://github.com/oterrier/gracyql-kotlin
Maybe it could be interesting for the community ?
Cheers
Olivier Terrier
Beta Was this translation helpful? Give feedback.
All reactions