Using annotation tools without localhost loopback?

Hi There,
Is there any way (Jupyter notebook or JupyterLab) to use the annotation tool without a local loopback mechanism (i.e. access localhost without requiring a physical network interface?). I am in an environment where you are extraordinarily restricted (very few ports are whitelisted) and am trying to come-up with an acceptable approach to InfoSec. At the moment, I'm going to be line editing the JSONL file.

Hm, I hadn't thought of that restriction!

I think FastAPI should be able to listen on a unix domain socket file instead of the localhost. @tiangolo, is it possible?

So, first, yes, FastAPI is run by Uvicorn, and Uvicorn can listen on a Unix socket, e.g.:

from fastapi import FastAPI
import uvicorn

app = FastAPI()

async def root():
    return {"message": "Hello World"}

if __name__ == "__main__":, uds="./prodigy.sock")

Then you could start it with:

$ python

INFO:     Started server process [10667]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on unix socket ./prodigy.sock (Press CTRL+C to quit)

...and then from another terminal you could communicate with the socket using HTTP:

$ printf 'GET /hello HTTP/1.1\r\n\r\n' | nc -q 2 -U ./prodigy.sock

HTTP/1.1 200 OK
date: Wed, 22 Jul 2020 14:25:27 GMT
server: uvicorn
content-length: 25
content-type: application/json

{"message":"Hello World"}

So, yes, Prodigy should be runnable from a socket... I'm not sure yet what would be the details, but I suspect that wouldn't really solve the problem... :thinking:

@SharplyUnclear Would something like that, using a Unix socket, help for your use case?

The problem I see is that a browser won't be able to communicate using HTTP with a Unix socket, so, at some point, something will have to be listening on a port for localhost or some other domain that you have access to. The same happens with Jupyter or JupyterLab, they just open a server listening on port 8888 of the localhost (IP

If you have a predefined set of available ports, you could tell Prodigy to use one of those with the port option or the PRODIGY_PORT environment variable:

Otherwise, maybe a previous question could be, how would you access the Prodigy web UI?

Or maybe you could share some more details about your environment, are you running Prodigy on the same machine accessing it in the web browser or another machine? Which OS are you using? Do you have any type of setup with a reverse proxy, or something similar?

Yes, running off a UNIX socket gives me some options to discuss with InfoSec...
...let's see how useful it is.

Thank you.