Bhaskar2611 commited on
Commit
ea26998
·
verified ·
1 Parent(s): a2751b6

Create planner.py

Browse files
Files changed (1) hide show
  1. planner.py +34 -0
planner.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # planner.py
2
+ from huggingface_hub import InferenceClient
3
+ import re
4
+
5
+ # Get your HF token from secrets (set in HF Spaces)
6
+ import os
7
+ HF_TOKEN = os.getenv("HF_TOKEN")
8
+
9
+ client = InferenceClient(
10
+ "Qwen/Qwen2.5-Coder-7B-Instruct",
11
+ token=HF_TOKEN
12
+ )
13
+
14
+ def generate_task_plan(goal: str) -> str:
15
+ prompt = f"""
16
+ Break down the following goal into actionable tasks with:
17
+ - Clear task descriptions
18
+ - Realistic deadlines (relative to today)
19
+ - Dependencies between tasks (if any)
20
+
21
+ Format your response as a numbered list with this structure:
22
+ 1. [Task name] - Due: [Day X] - Depends on: [Task # or "None"]
23
+ Description: [Brief explanation]
24
+
25
+ Goal: "{goal}"
26
+ """
27
+
28
+ response = client.text_generation(
29
+ prompt,
30
+ max_new_tokens=2048,
31
+ temperature=0.3,
32
+ repetition_penalty=1.2
33
+ )
34
+ return response.strip()