Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import time
|
3 |
+
|
4 |
+
# Title
|
5 |
+
st.title("⏳ Productivity Timer (Pomodoro Technique)")
|
6 |
+
|
7 |
+
# Sidebar for Timer Settings
|
8 |
+
st.sidebar.header("Timer Settings")
|
9 |
+
|
10 |
+
# Timer Intervals
|
11 |
+
work_duration = st.sidebar.number_input("Work Duration (minutes)", min_value=1, max_value=60, value=25, step=1)
|
12 |
+
break_duration = st.sidebar.number_input("Break Duration (minutes)", min_value=1, max_value=30, value=5, step=1)
|
13 |
+
|
14 |
+
# Start Timer Button
|
15 |
+
if st.sidebar.button("Start Pomodoro Timer"):
|
16 |
+
st.write(f"### 🛠️ Work Time: {work_duration} minutes")
|
17 |
+
for i in range(work_duration * 60):
|
18 |
+
mins, secs = divmod(work_duration * 60 - i, 60)
|
19 |
+
timer = f"{mins:02d}:{secs:02d}"
|
20 |
+
st.write(timer)
|
21 |
+
time.sleep(1)
|
22 |
+
st.empty()
|
23 |
+
st.success("✅ Work time is over! Time for a break.")
|
24 |
+
|
25 |
+
st.write(f"### ☕ Break Time: {break_duration} minutes")
|
26 |
+
for i in range(break_duration * 60):
|
27 |
+
mins, secs = divmod(break_duration * 60 - i, 60)
|
28 |
+
timer = f"{mins:02d}:{secs:02d}"
|
29 |
+
st.write(timer)
|
30 |
+
time.sleep(1)
|
31 |
+
st.empty()
|
32 |
+
st.success("🎉 Break time is over! Ready for another session?")
|
33 |
+
|
34 |
+
st.markdown("---")
|
35 |
+
st.caption("Developed with ❤️ using Streamlit and deployed on Hugging Face Spaces.")
|