Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ from datetime import datetime
|
|
| 5 |
def format_daily_plan(notes):
|
| 6 |
"""
|
| 7 |
Parses comma-separated notes/to-dos for time-stamped events and untimed tasks.
|
|
|
|
| 8 |
"""
|
| 9 |
entries = [n.strip() for n in notes.split(",") if n.strip()]
|
| 10 |
schedule = []
|
|
@@ -42,14 +43,16 @@ def format_daily_plan(notes):
|
|
| 42 |
# sort schedule by time
|
| 43 |
schedule.sort(key=lambda x: datetime.strptime(x[0], "%I:%M %p"))
|
| 44 |
|
| 45 |
-
# build output
|
| 46 |
-
|
| 47 |
for t, d in schedule:
|
| 48 |
-
|
| 49 |
if tasks:
|
| 50 |
-
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
return "\n".join(
|
| 53 |
|
| 54 |
|
| 55 |
# Gradio UI
|
|
@@ -62,8 +65,7 @@ iface = gr.Interface(
|
|
| 62 |
outputs=gr.Textbox(label="Today's Plan"),
|
| 63 |
title="🗒️ Daily Notes → Structured Plan",
|
| 64 |
description=(
|
| 65 |
-
"
|
| 66 |
-
"no AI model needed, runs in milliseconds."
|
| 67 |
),
|
| 68 |
theme="default"
|
| 69 |
)
|
|
|
|
| 5 |
def format_daily_plan(notes):
|
| 6 |
"""
|
| 7 |
Parses comma-separated notes/to-dos for time-stamped events and untimed tasks.
|
| 8 |
+
Outputs a schedule and a numbered task list.
|
| 9 |
"""
|
| 10 |
entries = [n.strip() for n in notes.split(",") if n.strip()]
|
| 11 |
schedule = []
|
|
|
|
| 43 |
# sort schedule by time
|
| 44 |
schedule.sort(key=lambda x: datetime.strptime(x[0], "%I:%M %p"))
|
| 45 |
|
| 46 |
+
# build output
|
| 47 |
+
lines = ["Today's Plan:\n"]
|
| 48 |
for t, d in schedule:
|
| 49 |
+
lines.append(f"{t}: {d}")
|
| 50 |
if tasks:
|
| 51 |
+
lines.append("\nTasks:")
|
| 52 |
+
for idx, task in enumerate(tasks, 1):
|
| 53 |
+
lines.append(f" {idx}. {task}")
|
| 54 |
|
| 55 |
+
return "\n".join(lines)
|
| 56 |
|
| 57 |
|
| 58 |
# Gradio UI
|
|
|
|
| 65 |
outputs=gr.Textbox(label="Today's Plan"),
|
| 66 |
title="🗒️ Daily Notes → Structured Plan",
|
| 67 |
description=(
|
| 68 |
+
"Convert your free-form notes into a time-based schedule and a structured, numbered task list."
|
|
|
|
| 69 |
),
|
| 70 |
theme="default"
|
| 71 |
)
|