rbanfield commited on
Commit
eabd2bd
·
1 Parent(s): 70a968f
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,14 +1,15 @@
1
  from subprocess import Popen, PIPE, STDOUT, check_output
 
2
  import gradio as gr
3
 
4
  def run(input_image):
5
  output = 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,
12
- inputs=gr.Image(type="pil", label="Input Image"),
13
  outputs=gr.Textbox(),
14
  ).launch()
 
1
  from subprocess import Popen, PIPE, STDOUT, check_output
2
+ import tempfile
3
  import gradio as gr
4
 
5
  def run(input_image):
6
  output = check_output(["chmod", "a+x", "bin/detect-image"])
7
+ cmd = 'bin/detect-image ' + input_image
8
  p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
9
  return p.stdout.read()
10
 
11
  gr.Interface(
12
  fn=run,
13
+ inputs=gr.Image(type="filepath", label="Input Image"),
14
  outputs=gr.Textbox(),
15
  ).launch()