from subprocess import Popen, PIPE, STDOUT, check_output import tempfile import gradio as gr def run(input_image): output = check_output(["chmod", "a+x", "bin/detect-image"]) cmd = 'bin/detect-image ' + input_image p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) return p.stdout.read() gr.Interface( fn=run, inputs=gr.Image(type="filepath", label="Input Image"), outputs=gr.Textbox(), ).launch()