herMaster commited on
Commit
8852ade
·
1 Parent(s): be6a71f

processing the subprocess output

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -44,8 +44,11 @@ def chat(question):
44
  ]
45
 
46
  # Run the command
47
- output = subprocess.run(command)
48
- return output
 
 
 
49
 
50
  screen = gr.Interface(
51
  fn = chat,
 
44
  ]
45
 
46
  # Run the command
47
+ output = subprocess.run(command, capture_output=True, text=True)
48
+ if output.returncode == 0:
49
+ return output.stdout
50
+ else:
51
+ return "Error" + output.stderrt
52
 
53
  screen = gr.Interface(
54
  fn = chat,