awacke1 commited on
Commit
4286f19
·
1 Parent(s): 5f2656b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -20
app.py CHANGED
@@ -1,27 +1,22 @@
1
  import streamlit as st
2
  import time
3
- from datetime import datetime
4
 
5
- # Set the time at the start of the program
6
- start_time = time.time()
7
 
8
- # Main loop
9
- while True:
10
- # Get the current time
11
- now = time.time()
12
 
13
- # Check if 15 seconds have passed
14
- if now - start_time >= 15:
15
- # Refresh the screen
16
- st.experimental_rerun()
17
 
18
- # Show the text area
19
- text_input = st.text_area('Crowdsource')
 
 
20
 
21
- # When data is saved there, append it to a "Log.txt" file
22
- if text_input:
23
- with open('Log.txt', 'a') as f:
24
- f.write(f"{datetime.now()}: {text_input}\n")
25
-
26
- # Sleep for a while to prevent the loop from running too fast
27
- time.sleep(1)
 
1
  import streamlit as st
2
  import time
 
3
 
4
+ def main():
5
+ st.title("Simple Streamlit Program")
6
 
7
+ # Wait for 5 seconds
8
+ with st.spinner("Waiting for 5 seconds..."):
9
+ time.sleep(5)
10
+ st.success("Completed!")
11
 
12
+ # File Upload
13
+ st.header("File Upload")
14
+ uploaded_file = st.file_uploader("Upload a file")
 
15
 
16
+ if uploaded_file is not None:
17
+ file_contents = uploaded_file.read()
18
+ st.markdown("### File Contents")
19
+ st.markdown(f"```{file_contents.decode('utf-8')}```")
20
 
21
+ if __name__ == "__main__":
22
+ main()