16 November 2022

cli2web -

I’d love to start building a Transformer that takes the code of a CLI tool (start with just Python) and then automatically generate an HTML + CSS + JavaScript UI for invoking the same CLI executable. I have a lot of CLIs that I’d love to have exposed as web tools.

Example:

input

import fire

def process_pictures(picture_folder_path, days_back=10, process_faces=False):
    print("Doing work...This is a log")
    print(f"{picture_folder_path=}, {days_back=}, {process_faces=}")

    for i in range(0, 10):
        print(f"Doing work...This is a log {i}")
        
    return True

if __name__ == "__main__":
    fire.Fire(process_pictures)

which could quickly generate: (1) the UI, and (2) a backend to wire things up. Bonus credit for getting tables, image paths, and other complex UIs working.

output: a working Web App

Picture Folder Path:
Days Back:
Process Faces:
Result:

        
Stdout (Print):

    

The actual code as an example is below. I’m writing this as a test prompt for Codex. Then I’ll do a bit of work to see if I can generate it.

output details

Maybe I can do this with Codex?

For now, the start of this endeavour is in GitHub at xeb/cli2web