File size: 425 Bytes
78709a4
671307d
 
 
78709a4
4233462
 
 
671307d
 
 
134eef3
671307d
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from subprocess import Popen, PIPE, STDOUT, check_output
import gradio as gr

def run(input_image):
    output = check_output(["chmod", "a+x", "bin/detect-image"])
    cmd = 'bin/detect-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="pil", label="Input Image"),
    outputs=gr.Textbox(),
).launch()