Cannot access prodigy from external ip

Hi. I’m hosting Prodigy on my local machine with the host set to 0.0.0.0. While I can access the web instance from any machine on my local network, I can’t access it from a public network. I’m using a proxy to serve the port to external requests and have configured Windows Firewall to allow traffic. I tested the same port with a simple Python Flask app, and it works fine.

Could there be any settings in Prodigy that block external access?

So just to clarify, if you write a simple Flask test app and serve that on 0.0.0.0 on the relevant port it works, but when you run Prodigy it doesn't?

That's correct. I am testing on port 8001. When I run a Flask app on this port, I can access it externally without any issues.

Flask app:

from flask import Flask

app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello, World!'

if __name__ == '__main__':
    app.run(host='0.0.0.0',port=8001)

However, when I run Prodigy on the same port, it works within my network but returns a 503 error for external access.

Custom recipe:

@prodigy.recipe(
    "myimage.manual",
    dataset=("The dataset to use", "positional", None, str),
    source=("Path to a directory of images", "positional", None, str),
    label=("One or more comma-separated labels", "option", None, split_string)
)
def image_manual(
    dataset: str,
    source: str,
    label: List[str] = None
):
    stream = get_stream(source, rehash=True)

    return {
        "view_id": "image_manual",
        "dataset": dataset,
        "stream": stream,
        "config": {
            "port": 8001,
            "label": ", ".join(label) if label is not None else "all",
            "labels": label,
            "host": "0.0.0.0"
        },
    }

Thanks for the code, the Flask test makes perfect sense.

Could you try setting the port with the PRODIGY_PORT and PRODIGY_HOST environment variables instead? I'm not 100% sure whether these were supposed to be configurable in the recipe config. It's possible there's an error in the docs.

In our deployments we usually want to set this outside the recipe, as it's more a parameter of the hosting environment than the code. So I don't know that we have tests for setting these inside the recipe config. You can also set them in the prodigy.json: Installation & Setup · Prodigy · An annotation tool for AI, Machine Learning & NLP

Thanks for the reply. I found the reason. My proxy constantly checks the service health with options request, and prodigy may not have that implemented, which lead to 503 error. I updated my proxy to check the service using get request and now I can access the service externally.

Fyi, I tested the custom recipe config, both host and port works, but if there is a prodigy.json, it will override my recipe config.