BulatF commited on
Commit
f1c0213
1 Parent(s): 2e67a08

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +65 -0
app.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from datetime import datetime
3
+ from get_next_standup_taker import get_next_standup_taker, team_members
4
+ from datasets import load_dataset, load_metric
5
+
6
+ # Initialize or load dataset
7
+ dataset_repo_id = "BulatF/standup_taker_dataset"
8
+ dataset = load_dataset(dataset_repo_id, split='train', streaming=True)
9
+
10
+ # Initialize login state
11
+ if 'logged_in' not in st.session_state:
12
+ st.session_state.logged_in = False
13
+
14
+ # Login Screen
15
+ if not st.session_state.logged_in:
16
+ st.title("Login to Stand-Up Taker App")
17
+ username = st.text_input("Username:")
18
+ password = st.text_input("Password:", type="password")
19
+
20
+ if st.button("Login"):
21
+ if username == "analytics" and password == "try_me_123!":
22
+ st.session_state.logged_in = True
23
+ st.experimental_rerun() # Rerun the app to redirect to the main app
24
+ else:
25
+ st.warning("Invalid username or password")
26
+
27
+ # Main App
28
+ if st.session_state.logged_in:
29
+ st.title("Stand-Up Taker App")
30
+ st.write("This app determines who takes the stand-up on Tuesdays and Thursdays.")
31
+
32
+ # Read the last entry from the dataset
33
+ last_entry = next(dataset)
34
+ last_standup_taker = last_entry['standup_taker']
35
+ last_date = last_entry['date']
36
+
37
+ # Button to check today's stand-up taker
38
+ if st.button("Who is taking the stand-up today?"):
39
+ next_taker = get_next_standup_taker(last_standup_taker, last_date)
40
+ st.write(f"The person taking the stand-up today is **{next_taker}**.")
41
+
42
+ # Update dataset with new standup taker and date
43
+ dataset = dataset.add_item({
44
+ 'standup_taker': next_taker,
45
+ 'date': datetime.now().strftime("%Y-%m-%d")
46
+ })
47
+
48
+ # Initialize state for text field
49
+ if 'forced_taker' not in st.session_state:
50
+ st.session_state.forced_taker = ""
51
+
52
+ # Field and button to force a specific person for the stand-up
53
+ st.session_state.forced_taker = st.text_input("Force a specific person to take the stand-up:", st.session_state.forced_taker)
54
+
55
+ if st.button("Force Stand-Up"):
56
+ if st.session_state.forced_taker in team_members:
57
+ # Update dataset with forced standup taker and date
58
+ dataset = dataset.add_item({
59
+ 'standup_taker': st.session_state.forced_taker,
60
+ 'date': datetime.now().strftime("%Y-%m-%d")
61
+ })
62
+
63
+ st.write(f"The stand-up taker has been forced to **{st.session_state.forced_taker}**.")
64
+ else:
65
+ st.write("Invalid name. Please enter a valid team member name.")