Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ model = AutoModelForCausalLM.from_pretrained(model_name)
|
|
17 |
tokenizer.pad_token = tokenizer.eos_token
|
18 |
model.config.pad_token_id = tokenizer.eos_token_id
|
19 |
|
20 |
-
# Define a
|
21 |
PROMPT_TEMPLATE = """You are an AI coach for construction supervisors. Based on the following inputs, generate a daily checklist, focus suggestions, and a motivational quote. Format your response with clear labels as follows:
|
22 |
|
23 |
Checklist:
|
@@ -29,38 +29,6 @@ Suggestions:
|
|
29 |
Quote:
|
30 |
- Your motivational quote here
|
31 |
|
32 |
-
Here are examples of expected outputs:
|
33 |
-
|
34 |
-
Example 1:
|
35 |
-
Inputs:
|
36 |
-
Role: Supervisor
|
37 |
-
Project: PROJ-01
|
38 |
-
Milestones: Lay foundation, Check materials
|
39 |
-
Reflection: Team is on track, but weather might delay work.
|
40 |
-
Checklist:
|
41 |
-
- Confirm foundation laying schedule by 8 AM.
|
42 |
-
- Inspect materials for quality at 10 AM.
|
43 |
-
Suggestions:
|
44 |
-
- Monitor weather updates and plan contingencies.
|
45 |
-
- Ensure team has protective gear for rain.
|
46 |
-
Quote:
|
47 |
-
- Stay steady—every foundation leads to greater heights!
|
48 |
-
|
49 |
-
Example 2:
|
50 |
-
Inputs:
|
51 |
-
Role: Foreman
|
52 |
-
Project: PROJ-02
|
53 |
-
Milestones: Install beams, Safety check
|
54 |
-
Reflection: Minor delay due to late delivery.
|
55 |
-
Checklist:
|
56 |
-
- Oversee beam installation starting at 9 AM.
|
57 |
-
- Conduct safety check at 1 PM.
|
58 |
-
Suggestions:
|
59 |
-
- Follow up with supplier to prevent future delays.
|
60 |
-
- Review safety protocols with the team.
|
61 |
-
Quote:
|
62 |
-
- Safety first, progress always—keep the momentum!
|
63 |
-
|
64 |
Now, generate the checklist, suggestions, and quote for the following inputs:
|
65 |
|
66 |
Inputs:
|
@@ -68,8 +36,7 @@ Role: {role}
|
|
68 |
Project: {project_id}
|
69 |
Milestones: {milestones}
|
70 |
Reflection: {reflection}
|
71 |
-
|
72 |
-
Generate the response in the same format as the examples above."""
|
73 |
|
74 |
# Cache reset check
|
75 |
last_reset = datetime.date.today()
|
@@ -213,4 +180,4 @@ def create_interface():
|
|
213 |
|
214 |
if __name__ == "__main__":
|
215 |
demo = create_interface()
|
216 |
-
demo.launch()
|
|
|
17 |
tokenizer.pad_token = tokenizer.eos_token
|
18 |
model.config.pad_token_id = tokenizer.eos_token_id
|
19 |
|
20 |
+
# Define a prompt template (no examples, just structured prompt)
|
21 |
PROMPT_TEMPLATE = """You are an AI coach for construction supervisors. Based on the following inputs, generate a daily checklist, focus suggestions, and a motivational quote. Format your response with clear labels as follows:
|
22 |
|
23 |
Checklist:
|
|
|
29 |
Quote:
|
30 |
- Your motivational quote here
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
Now, generate the checklist, suggestions, and quote for the following inputs:
|
33 |
|
34 |
Inputs:
|
|
|
36 |
Project: {project_id}
|
37 |
Milestones: {milestones}
|
38 |
Reflection: {reflection}
|
39 |
+
"""
|
|
|
40 |
|
41 |
# Cache reset check
|
42 |
last_reset = datetime.date.today()
|
|
|
180 |
|
181 |
if __name__ == "__main__":
|
182 |
demo = create_interface()
|
183 |
+
demo.launch()
|