awacke1 commited on
Commit
8c881ff
·
verified ·
1 Parent(s): eb7de36

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ # Initialize session state
4
+ if 'username' not in st.session_state:
5
+ st.session_state.username = ''
6
+ if 'scratch_pad' not in st.session_state:
7
+ st.session_state.scratch_pad = ''
8
+
9
+ def save_session():
10
+ st.session_state.username = username
11
+ st.session_state.scratch_pad = scratch_pad
12
+
13
+ st.title("Welcome to My App")
14
+
15
+ if st.session_state.username:
16
+ st.subheader(f"Welcome back, {st.session_state.username}!")
17
+ scratch_pad = st.text_area("Scratch Pad", value=st.session_state.scratch_pad, height=200)
18
+ if st.button("💾 Save"):
19
+ save_session()
20
+ else:
21
+ username = st.text_input("Please enter your name:")
22
+ if st.button("🔑 Login"):
23
+ save_session()