Lab 3: Artifacts, build a toy spam filter
Time: 6 min · Model: Sonnet · Messages: 1 · Goal: feel how machine learning trades off mistakes, using an interactive Artifact (a live app in a side panel).
Steps
- Click New chat and choose Sonnet.
-
Copy the prompt, paste it, press Enter.
Create a small interactive web app (single page, under 100 lines of code) called "Teach a Spam Filter". - Show 8 short example emails: 4 spam and 4 normal. Include 2 tricky ones (a normal email that says "urgent", and a spam email with no obvious spam words). - Each email gets a "spam score" based on suspicious words (free, winner, urgent, click, prize, password). - Add a slider "Strictness" from 0 to 100. Emails whose score is above the slider threshold are marked SPAM. - Show live counters: "Correct", "Spam missed", "Good emails blocked". - Big readable text, soft colours, one line at the top: "Move the slider: stricter catches more spam but may block good emails." No external libraries. -
When the Artifact opens in the side panel, drag the slider (do not send more messages).
- Try to find the setting with the fewest mistakes. Can you reach zero of both kinds?
- Type in the course chat: "Which would you hate more at work: missed spam or a blocked invoice?"
You should see
A single-page app with a slider and three counters. The words and scores vary, which is normal.
If something goes wrong
If the artifact does not appear, send one fix message: "Please show it in the Artifact preview." If your limit is reached, watch the trainer's screen.
Greek version (ελληνικά)
Δημιούργησε μια μικρή διαδραστική εφαρμογή ιστού (μία σελίδα, κάτω από 100 γραμμές κώδικα) με τίτλο «Εκπαίδευσε ένα φίλτρο spam».
- Δείξε 8 σύντομα παραδείγματα email: 4 spam και 4 κανονικά. Συμπερίλαβε 2 δύσκολα (ένα κανονικό email που λέει «επείγον» και ένα spam χωρίς εμφανείς λέξεις spam).
- Κάθε email παίρνει «βαθμό spam» με βάση ύποπτες λέξεις (δωρεάν, νικητής, επείγον, πατήστε, έπαθλο, κωδικός).
- Πρόσθεσε ρυθμιστικό «Αυστηρότητα» από 0 έως 100. Τα email με βαθμό πάνω από το όριο σημαίνονται ως SPAM.
- Δείξε ζωντανούς μετρητές: «Σωστά», «Spam που ξέφυγε», «Καλά email που μπλοκαρίστηκαν».
- Μεγάλα ευανάγνωστα γράμματα, απαλά χρώματα και μια γραμμή στην κορυφή: «Μετακίνησε το ρυθμιστικό: πιο αυστηρό πιάνει περισσότερο spam αλλά μπορεί να μπλοκάρει καλά email.»
Χωρίς εξωτερικές βιβλιοθήκες.
Key idea
AI classifiers do not "know". They score probabilities, and a human-chosen threshold decides. The same trade-off appears in fraud detection, medical screening and AI-text detectors. Artifacts also let you build checklists, calculators, diagrams and documents from one sentence.
Other assistants
Equivalent live-build panels: ChatGPT Canvas, Gemini Canvas, Microsoft Copilot Pages.