Spaces:
Runtime error
Runtime error
import streamlit as st | |
# Create a list to hold messages | |
messages = [] | |
# Define a function to handle form submissions | |
def handle_form_submit(form_data): | |
message = form_data["message"] | |
messages.append(message) | |
# Define the layout of the app | |
st.title("Scrollable Output and Submitable Form") | |
st.write("Enter a message below and click 'Submit' to add it to the output:") | |
# Add the input form | |
form = st.form(key="message_form") | |
message_input = form.text_input(label="Message:") | |
submit_button = form.form_submit_button(label="Submit", on_click=handle_form_submit, args=(form_data,)) | |
st.write("") | |
# Add the output window | |
if len(messages) > 0: | |
st.write("Output:") | |
with st.beta_container(): | |
for message in messages: | |
st.write("- " + message) | |
else: | |
st.write("No messages yet.") | |
"""import pexpect | |
import time | |
# Start the other program | |
child = pexpect.spawn("python DO_NOT_COMMIT.py", encoding='utf-8', timeout=None) | |
while True: | |
child.expect(">>>>>") | |
print(child.before) | |
child.sendline(input(">>>>>"))""" | |