Running prodigy stats using prodigy.serve

Hi,

As part of my effort to automate the review process for our users, I'm trying to run the stats command from a python script using prodigy.serve (I intend to parse the output and use it later on):

import prodigy

annotation_server_args_string = 'stats -l'
prodigy.serve(annotation_server_args_string)

The output does get printed to stdout but the program ends with exit code 1 and an error message:

✘ Can't serve 'prodigy'. It doesn't seem to be a recipe that requires
the Prodigy server to be started.

Why am I getting this error message (more importantly, why does the program exit)?

Thanks in advance...

Hi @shuki,

The majority of Prodigy recipes that require the web UI spin up the annotation server. There are others (which we call "commands") that do not require the UI and are used only in terminal. stats is one of them which is why it is not supposed to be used with prodigy.serve.
The good news is that "commands" are just python scripts that you can import to your code and use directly.
This post shows how to use stats programmatically from Python. Let me know if that doesn't work for you.

Hi @magdaaniol,

Thank you for the reference, will give it a try.