Skip to content

Commit cb33ce0

Browse files
committed
update code snippet
1 parent 19462f3 commit cb33ce0

File tree

1 file changed

+20
-32
lines changed

1 file changed

+20
-32
lines changed

src/components/DemoPage.jsx

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,31 @@ const DemoPage = () => {
1818
setSelectedHour(newHour);
1919
};
2020

21-
const codeString = `from gum import GUMClient, ObservationType
21+
const codeString = `from dotenv import load_dotenv
22+
load_dotenv()
2223
23-
# Initialize the GUM client
24-
client = GUMClient(api_key="your_api_key_here")
24+
from gum import gum
25+
from gum.observers import Screen
26+
import time
2527
26-
# Collect observations from various sources
27-
observations = [
28-
{"type": ObservationType.SCREENSHOT, "data": screenshot_bytes, "timestamp": "2024-05-10T13:45:00Z"},
29-
{"type": ObservationType.TEXT, "data": "Meeting with Alex about project timeline", "timestamp": "2024-05-10T14:00:00Z"},
30-
{"type": ObservationType.APP_USAGE, "data": {"app": "VSCode", "duration": 3600}, "timestamp": "2024-05-10T15:30:00Z"}
31-
]
32-
33-
# Add observations to user model
34-
client.add_observations(observations)
35-
36-
# Query the user model to get personalized insights
37-
results = client.query(
38-
query="What is the user working on today?",
39-
confidence_threshold=0.7
28+
# Create observer instances
29+
screen_observer = Screen()
30+
g = gum(
31+
"Test User",
32+
screen_observer,
4033
)
4134
42-
# Use insights to power proactive assistance
43-
if "project deadline" in results.topics:
44-
reminder = client.generate_reminder(
45-
context=results,
46-
urgency="medium"
47-
)
48-
49-
print(f"Suggested reminder: {reminder}")
50-
51-
# Retrieve user preferences for a specific context
52-
preferences = client.get_preferences(
53-
context="code editor",
54-
attributes=["theme", "font_size", "language"]
55-
)
35+
# Start the update loop
36+
g.start_update_loop()
5637
57-
print(f"User's coding preferences: {preferences}")`;
38+
try:
39+
# Keep the main thread alive
40+
while True:
41+
time.sleep(1)
42+
except KeyboardInterrupt:
43+
# Handle clean shutdown when Ctrl+C is pressed
44+
print("Shutting down...")
45+
g.stop_update_loop()`;
5846

5947
return (
6048

0 commit comments

Comments
 (0)