rijdev commited on
Commit
88490ac
·
verified ·
1 Parent(s): 1cf94be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
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 strings
46
- plan_lines = ["Today's Plan:\n"]
47
  for t, d in schedule:
48
- plan_lines.append(f"{t}: {d}")
49
  if tasks:
50
- plan_lines.append("\nTasks: " + ", ".join(tasks))
 
 
51
 
52
- return "\n".join(plan_lines)
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
- "Quickly turn your free-form notes into a time-based schedule and task list"
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
  )