Spaces:
Runtime error
Runtime error
Hugo Garcia-Cotte
commited on
Commit
•
798fb24
1
Parent(s):
7a7b84a
playing around with Streamli
Browse files
app.py
CHANGED
@@ -1,28 +1,38 @@
|
|
1 |
import streamlit as st
|
|
|
|
|
2 |
|
3 |
# Initialize a list of messages
|
4 |
# Initialization
|
5 |
if 'messages' not in st.session_state:
|
6 |
st.session_state['messages'] = []
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
# Create a text input field for users to enter their messages
|
9 |
user_input = st.text_input("Enter your message here:")
|
10 |
|
11 |
# Add user's message to the list when the submit button is clicked
|
12 |
if st.button("Submit"):
|
13 |
st.session_state['messages'].append(user_input)
|
|
|
14 |
|
15 |
# Display the list of messages
|
16 |
st.write("List of messages:")
|
17 |
for msg in st.session_state['messages']:
|
18 |
-
st.write(
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
-
"""import pexpect
|
24 |
-
import time
|
25 |
|
|
|
26 |
# Start the other program
|
27 |
child = pexpect.spawn("python DO_NOT_COMMIT.py", encoding='utf-8', timeout=None)
|
28 |
|
|
|
1 |
import streamlit as st
|
2 |
+
import pexpect
|
3 |
+
import time
|
4 |
|
5 |
# Initialize a list of messages
|
6 |
# Initialization
|
7 |
if 'messages' not in st.session_state:
|
8 |
st.session_state['messages'] = []
|
9 |
|
10 |
+
if 'child' not in st.session_state:
|
11 |
+
st.session_state['child'] = pexpect.spawn("python danse_macabre.py", encoding='utf-8', timeout=None)
|
12 |
+
|
13 |
+
child = st.session_state['child']
|
14 |
+
|
15 |
+
child.expect(">>>>>")
|
16 |
+
st.session_state['messages'].append(child.before)
|
17 |
+
|
18 |
# Create a text input field for users to enter their messages
|
19 |
user_input = st.text_input("Enter your message here:")
|
20 |
|
21 |
# Add user's message to the list when the submit button is clicked
|
22 |
if st.button("Submit"):
|
23 |
st.session_state['messages'].append(user_input)
|
24 |
+
child.sendline(user_input)
|
25 |
|
26 |
# Display the list of messages
|
27 |
st.write("List of messages:")
|
28 |
for msg in st.session_state['messages']:
|
29 |
+
st.write(msg)
|
30 |
|
31 |
|
32 |
|
33 |
|
|
|
|
|
34 |
|
35 |
+
"""
|
36 |
# Start the other program
|
37 |
child = pexpect.spawn("python DO_NOT_COMMIT.py", encoding='utf-8', timeout=None)
|
38 |
|