Download index.html from Battlettt/smishield: direct link, hf CLI and curl.
- Browser
- Download file 10.9 kB
-
https://huggingface.co/spaces/Battlettt/smishield/resolve/main/index.html
- Command line
-
hf download hf://spaces/Battlettt/smishield/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Battlettt/smishield/resolve/main/index.html
10.9 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self'; font-src 'self'; connect-src 'self'; img-src 'self' data:; base-uri 'none'; form-action 'none'"> | |
| <meta name="referrer" content="no-referrer"> | |
| <meta name="color-scheme" content="light dark"> | |
| <title>smishield: a lie detector for text messages</title> | |
| <meta name="description" content="Paste a text message and watch a small spam model read it word by word. Verdict, probability and the words behind it, computed entirely in your browser."> | |
| <link rel="icon" href="favicon.svg" type="image/svg+xml"> | |
| <link rel="preload" href="fonts/archivo-var.woff2" as="font" type="font/woff2" crossorigin> | |
| <link rel="stylesheet" href="style.css"> | |
| </head> | |
| <body> | |
| <a class="skip" href="#message">Skip to the message box</a> | |
| <header class="masthead"> | |
| <p class="wordmark">smishield</p> | |
| <h1>A lie detector for text messages</h1> | |
| <p class="lede">Paste a suspicious SMS. A small model reads it word by word, the needle tracks its suspicion, and nothing you paste leaves this tab.</p> | |
| </header> | |
| <main class="bench"> | |
| <section class="subject" aria-labelledby="subject-heading"> | |
| <h2 id="subject-heading" class="visually-hidden">The message under examination</h2> | |
| <div class="phone"> | |
| <div class="phone-notch" aria-hidden="true"></div> | |
| <div class="phone-contact"> | |
| <span class="avatar" aria-hidden="true">?</span> | |
| <div class="contact-field"> | |
| <label for="sender">From <span class="optional">(optional)</span></label> | |
| <input id="sender" type="text" autocomplete="off" spellcheck="false" placeholder="Number, short code or name" aria-describedby="sender-help"> | |
| </div> | |
| </div> | |
| <p id="sender-help" class="visually-hidden">The number, short code, name or email address the message came from. Used only for the pattern checks.</p> | |
| <div class="phone-screen"> | |
| <label for="message" class="bubble-label">Text message</label> | |
| <textarea id="message" class="bubble" rows="6" placeholder="Paste the text message here" spellcheck="false" aria-describedby="run-hint"></textarea> | |
| </div> | |
| </div> | |
| <div class="run"> | |
| <button id="analyze" class="run-button" type="button" disabled>Run the test</button> | |
| <p id="run-hint" class="run-hint">or press <kbd>Ctrl</kbd> + <kbd>Enter</kbd> in the message box</p> | |
| </div> | |
| <p id="status" class="status" role="status">Loading the model</p> | |
| <div class="cases" role="group" aria-labelledby="cases-heading"> | |
| <h3 id="cases-heading" class="cases-heading">Case files</h3> | |
| <button type="button" class="case" data-example="smishing"> | |
| <span class="case-tab">Case 1</span> | |
| <span class="case-title">Parcel fee</span> | |
| <span class="case-meta">Modern smishing, written for this demo</span> | |
| </button> | |
| <button type="button" class="case" data-example="prize"> | |
| <span class="case-tab">Case 2</span> | |
| <span class="case-title">Prize draw</span> | |
| <span class="case-meta">Real spam from the dataset</span> | |
| </button> | |
| <button type="button" class="case" data-example="legit"> | |
| <span class="case-tab">Case 3</span> | |
| <span class="case-title">Dinner plans</span> | |
| <span class="case-meta">Ordinary message, written for this demo</span> | |
| </button> | |
| </div> | |
| </section> | |
| <div class="record"> | |
| <section class="instrument" aria-labelledby="chart-heading"> | |
| <div class="instrument-head"> | |
| <h2 id="chart-heading">Suspicion trace</h2> | |
| <p class="readout" aria-hidden="true"><span class="readout-label">P(spam)</span> <span id="readout">--</span></p> | |
| </div> | |
| <div class="chart" id="chart-wrap"> | |
| <svg id="chart" viewBox="0 0 600 240" preserveAspectRatio="none" role="img" aria-labelledby="chart-desc"> | |
| <rect class="zone" x="0" y="12" width="600" height="108"></rect> | |
| <line class="threshold" x1="0" y1="120" x2="600" y2="120"></line> | |
| <path id="trace" class="trace" d=""></path> | |
| <line id="pen-arm" class="pen-arm" x1="600" y1="200" x2="600" y2="200"></line> | |
| </svg> | |
| <span id="pen" class="pen" aria-hidden="true"></span> | |
| <span class="axis axis-top" aria-hidden="true">100%</span> | |
| <span class="axis axis-mid" aria-hidden="true">threshold 50%</span> | |
| <span class="axis axis-low" aria-hidden="true">0%</span> | |
| <span class="zone-label" aria-hidden="true">spam side</span> | |
| </div> | |
| <p id="chart-desc" class="chart-caption">The needle rests until a message is examined. Paste one into the phone or open a case file.</p> | |
| </section> | |
| <section id="result" class="finding" aria-labelledby="finding-heading" hidden> | |
| <div class="finding-head"> | |
| <h2 id="finding-heading" class="form-title">Examiner's finding</h2> | |
| <p id="verdict" class="stamp"></p> | |
| </div> | |
| <dl class="readings"> | |
| <div><dt>Spam probability</dt><dd id="probability">--</dd></div> | |
| <div><dt>Decision threshold</dt><dd>50%</dd></div> | |
| <div><dt>Confidence</dt><dd id="confidence">--</dd></div> | |
| <div><dt>Tokens read</dt><dd id="tokens-read">--</dd></div> | |
| </dl> | |
| <p id="close-call" class="close-call" hidden></p> | |
| <p id="summary" class="summary"></p> | |
| <h3 class="sheet-heading">Transcript, marked up</h3> | |
| <div class="transcript-wrap"> | |
| <p id="transcript" class="transcript"></p> | |
| </div> | |
| <p class="key"> | |
| <span class="key-item"><span class="key-swatch key-spam" aria-hidden="true"></span>Red ink: pushes toward spam</span> | |
| <span class="key-item"><span class="key-swatch key-ham" aria-hidden="true"></span>Pencil: pushes toward legitimate</span> | |
| </p> | |
| <div class="exhibits"> | |
| <div> | |
| <h3 class="sheet-heading">Exhibits against</h3> | |
| <ol id="spam-terms" class="exhibit-list exhibit-spam"></ol> | |
| </div> | |
| <div> | |
| <h3 class="sheet-heading">Exhibits in favour</h3> | |
| <ol id="ham-terms" class="exhibit-list exhibit-ham"></ol> | |
| </div> | |
| </div> | |
| <p class="fine">Each number is the term's push on the model's log-odds (TF-IDF weight times coefficient). Positive pushes toward spam.</p> | |
| <h3 class="sheet-heading">Examiner's notes</h3> | |
| <ul id="signals" class="notes"></ul> | |
| <p class="fine">These are pattern checks for common smishing tricks. They explain the result but do not move the needle.</p> | |
| </section> | |
| <p id="announce" class="visually-hidden" aria-live="polite"></p> | |
| </div> | |
| </main> | |
| <section class="calibration" aria-labelledby="calibration-heading"> | |
| <div class="calibration-inner"> | |
| <div class="cal-lead"> | |
| <h2 id="calibration-heading">Calibration record</h2> | |
| <p class="cal-copy">How often the instrument was right on <span id="cal-test">1,115</span> held-out messages it never saw during training.</p> | |
| <p class="cal-f1"><span id="m-f1" class="cal-big">--</span><span class="cal-big-label">F1 on spam</span></p> | |
| </div> | |
| <dl class="cal-grid"> | |
| <div><dt>Accuracy</dt><dd id="m-accuracy">--</dd></div> | |
| <div><dt>Precision</dt><dd id="m-precision">--</dd></div> | |
| <div><dt>Recall</dt><dd id="m-recall">--</dd></div> | |
| </dl> | |
| <div class="cm-block"> | |
| <table class="cm"> | |
| <caption>Confusion matrix, held-out test set</caption> | |
| <thead><tr><td></td><th scope="col">Called legitimate</th><th scope="col">Called spam</th></tr></thead> | |
| <tbody> | |
| <tr><th scope="row">Was legitimate</th><td id="cm-tn" class="cm-right">--</td><td id="cm-fp" class="cm-wrong">--</td></tr> | |
| <tr><th scope="row">Was spam</th><td id="cm-fn" class="cm-wrong">--</td><td id="cm-tp" class="cm-right">--</td></tr> | |
| </tbody> | |
| </table> | |
| <p id="metrics-note" class="fine"></p> | |
| </div> | |
| </div> | |
| </section> | |
| <section class="limits" aria-labelledby="limits-heading"> | |
| <h2 id="limits-heading">Limits of the test</h2> | |
| <ol class="limits-list"> | |
| <li><strong>2012-era evidence.</strong> The model learned from the SMS Spam Collection, collected around 2011 and 2012. Modern smishing (fake parcel fees, bank and toll alerts, shortened links) looks different, so the model can miss it. The examiner's notes help explain those cases but do not change the score.</li> | |
| <li><strong>English only.</strong> The training messages are English, mostly from the UK and Singapore. Other languages will not be scored reliably.</li> | |
| <li><strong>Not a guarantee.</strong> This is a demo and learning project, not a replacement for your carrier's spam filtering or your phone's protections. "No deception indicated" does not mean a message is safe.</li> | |
| <li><strong>When in doubt,</strong> go to the organisation's own site or app instead of tapping a link. In the US and UK you can forward spam texts to 7726.</li> | |
| </ol> | |
| </section> | |
| <section class="method" aria-labelledby="method-heading"> | |
| <h2 id="method-heading">How the instrument works</h2> | |
| <ol class="method-steps"> | |
| <li><span class="step-name">Read.</span> The message is lowercased and split into words. Links, currency symbols and long numbers become placeholder tokens, and neighbouring word pairs are added.</li> | |
| <li><span class="step-name">Weigh.</span> Each word and pair is weighted by TF-IDF, using the vocabulary and IDF values learned during training.</li> | |
| <li><span class="step-name">Decide.</span> A logistic regression turns the weights into a spam probability. At 50% or above the message is flagged, the same rule used in training.</li> | |
| <li><span class="step-name">Trace.</span> The needle above re-scores the message after every word it has read, so you see where suspicion rose or fell. The final point is the verdict.</li> | |
| </ol> | |
| <p class="method-foot">Trained in Python with scikit-learn and exported to <a href="model.json">model.json</a>. Scoring is plain TypeScript with no machine-learning runtime. Metrics: <a href="metrics.json">metrics.json</a>. Source: <a href="https://github.com/battlettt/smishield">github.com/battlettt/smishield</a>.</p> | |
| </section> | |
| <footer class="colophon"> | |
| <p>Dataset: T. A. Almeida, J. M. Gómez Hidalgo and A. Yamakami, <em>SMS Spam Collection v.1</em>, UCI Machine Learning Repository (CC BY 4.0). Type: Archivo and IBM Plex Mono (SIL Open Font License).</p> | |
| </footer> | |
| <script src="app.js"></script> | |
| </body> | |
| </html> | |