rbanfield commited on
Commit
4233462
·
1 Parent(s): 025f865
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,10 +1,11 @@
1
- import subprocess
2
  import gradio as gr
3
 
4
  def run(input_image):
5
  output = subprocess.check_output(["chmod", "a+x", "bin/detect-image"])
6
- output = subprocess.check_output("bin/detect-image")
7
- return output.decode("utf-8")
 
8
 
9
  gr.Interface(
10
  fn=run,
 
1
+ from subprocess import Popen, PIPE, STDOUT
2
  import gradio as gr
3
 
4
  def run(input_image):
5
  output = subprocess.check_output(["chmod", "a+x", "bin/detect-image"])
6
+ cmd = 'bin/detect-image'
7
+ p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
8
+ return p.stdout.read()
9
 
10
  gr.Interface(
11
  fn=run,