Spaces:
Sleeping

raufoon commited on
Commit
b828d67
·
verified ·
1 Parent(s): f73aea7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -15,6 +15,8 @@ def run_code_with_inputs(code: str, inputs: str) -> str:
15
  filename = 'my_program.pseudo'
16
 
17
  try:
 
 
18
  with open(filename.removesuffix('.pseudo')+'.pseudo','wb') as file:
19
  file.write(code.encode('utf-8'))
20
  file_path = file.name
@@ -23,7 +25,7 @@ def run_code_with_inputs(code: str, inputs: str) -> str:
23
 
24
  processes, outputs, inputs = [], [], []
25
  processes.append(subprocess.run(
26
- ["pseudoku", file_path],
27
  text=True,
28
  capture_output=True,
29
  timeout=10
@@ -56,9 +58,6 @@ description = (
56
  "and return the entire program output."
57
  )
58
 
59
-
60
- import os
61
- pseudokey = os.getenv("pseudokey")
62
  with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_lg)) as demo:
63
  gr.Interface(
64
  fn=run_code_with_inputs,
 
15
  filename = 'my_program.pseudo'
16
 
17
  try:
18
+ import os
19
+ pseudokey = os.getenv("pseudokey")
20
  with open(filename.removesuffix('.pseudo')+'.pseudo','wb') as file:
21
  file.write(code.encode('utf-8'))
22
  file_path = file.name
 
25
 
26
  processes, outputs, inputs = [], [], []
27
  processes.append(subprocess.run(
28
+ ["pseudoku", file_path, repr(pseudokey), '--echo-inputs'],
29
  text=True,
30
  capture_output=True,
31
  timeout=10
 
58
  "and return the entire program output."
59
  )
60
 
 
 
 
61
  with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_lg)) as demo:
62
  gr.Interface(
63
  fn=run_code_with_inputs,