Spaces:
Runtime error
Runtime error
File size: 688 Bytes
a034352 6b13e5e a034352 6b13e5e a034352 6b13e5e a034352 6b13e5e a034352 6b13e5e 57a9fd0 a034352 6b13e5e a034352 6b13e5e |
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 |
import streamlit as st
import time
from datetime import datetime
# Set the time at the start of the program
start_time = time.time()
# Main loop
while True:
# Get the current time
now = time.time()
# Check if 15 seconds have passed
if now - start_time >= 15:
# Refresh the screen
st.experimental_rerun()
# Show the text area
text_input = st.text_area('Crowdsource', key=str(now))
# When data is saved there, append it to a "Log.txt" file
if text_input:
with open('Log.txt', 'a') as f:
f.write(f"{datetime.now()}: {text_input}\n")
# Sleep for a while to prevent the loop from running too fast
time.sleep(1)
|