StreamlitAIPP1 / app.py
awacke1's picture
Update app.py
5f2656b
raw
history blame
674 Bytes
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')
# 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)