Spaces:
Runtime error
Runtime error
File size: 715 Bytes
99f5743 4abf8ac b7524fd 4abf8ac de55d8c 418b498 f30aa1a 418b498 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
import streamlit as st
import subprocess
# Create an input text box
input_text = st.text_input('Enter some text')
def start(executable_file):
return subprocess.Popen(
executable_file,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
def read(process):
return process.stdout.readline().decode("utf-8").strip()
def write(process, message):
process.stdin.write(f"{message.strip()}\n".encode("utf-8"))
process.stdin.flush()
def terminate(process):
process.stdin.close()
process.terminate()
process.wait(timeout=0.2)
process = start("./danse_macabre.py")
write(process, "hello dummy")
st.write(read(process))
terminate(process)
|