VIDA-NYU / tile2net

Automated mapping of pedestrian networks from aerial imagery tiles
BSD 3-Clause "New" or "Revised" License
146 stars 22 forks source link

resolve interactive inference stalling #30

Closed dhodcz2 closed 1 year ago

dhodcz2 commented 1 year ago

When run in interactive mode, inference would stall because sys.stdin.isatty() returns True however no input is actually ever piped to the subprocess. The solution is to add another commandline argument, --interactive that serves as a flag that the process is being run interactively and shouldn't (indefinitely) try reading from stdin:

        if (
            not self.interactive
            and not sys.stdin.isatty()
            and (text := sys.stdin.read()) != ''
        ):

When Raster.inference runs the subprocess, the new arguments are:

        args = [
            'python',
            '-m',
            'tile2net',
            'inference',
            '--city_info',
            str(info),
            '--interactive',
        ]