Add initial VibeGuard browser extension
This commit is contained in:
parent
f251f0f8ce
commit
9c65a61ebb
43 changed files with 125275 additions and 2 deletions
12
public/manifest.chromium.json
Normal file
12
public/manifest.chromium.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"manifest_version": 3,
|
||||
"name": "VibeGuard",
|
||||
"version": "0.1.0",
|
||||
"description": "Hide toxic social-media posts locally.",
|
||||
"permissions": ["storage", "tabs", "offscreen"],
|
||||
"host_permissions": ["https://*.reddit.com/*", "https://*.x.com/*", "https://*.twitter.com/*", "https://*.facebook.com/*"],
|
||||
"background": { "service_worker": "background.js", "type": "module" },
|
||||
"content_scripts": [{ "matches": ["https://*.reddit.com/*", "https://*.x.com/*", "https://*.twitter.com/*", "https://*.facebook.com/*"], "js": ["content.js"], "run_at": "document_idle" }],
|
||||
"options_page": "options.html",
|
||||
"web_accessible_resources": [{ "resources": ["inference.js", "models/*"], "matches": ["<all_urls>"] }]
|
||||
}
|
||||
11
public/manifest.firefox.json
Normal file
11
public/manifest.firefox.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "VibeGuard",
|
||||
"version": "0.1.0",
|
||||
"description": "Hide toxic social-media posts locally.",
|
||||
"permissions": ["storage", "tabs", "https://*.reddit.com/*", "https://*.x.com/*", "https://*.twitter.com/*", "https://*.facebook.com/*"],
|
||||
"background": { "scripts": ["background.js"], "persistent": true },
|
||||
"content_scripts": [{ "matches": ["https://*.reddit.com/*", "https://*.x.com/*", "https://*.twitter.com/*", "https://*.facebook.com/*"], "js": ["content.js"], "run_at": "document_idle" }],
|
||||
"options_ui": { "page": "options.html", "open_in_tab": true },
|
||||
"web_accessible_resources": ["inference.js", "models/*"]
|
||||
}
|
||||
37
public/models/toxicity/config.json
Normal file
37
public/models/toxicity/config.json
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"activation": "gelu",
|
||||
"architectures": [
|
||||
"DistilBertForSequenceClassification"
|
||||
],
|
||||
"attention_dropout": 0.1,
|
||||
"bos_token_id": null,
|
||||
"dim": 768,
|
||||
"dropout": 0.1,
|
||||
"dtype": "float32",
|
||||
"eos_token_id": null,
|
||||
"hidden_dim": 3072,
|
||||
"id2label": {
|
||||
"0": "not_toxic",
|
||||
"1": "toxic"
|
||||
},
|
||||
"initializer_range": 0.02,
|
||||
"label2id": {
|
||||
"not_toxic": 0,
|
||||
"toxic": 1
|
||||
},
|
||||
"max_position_embeddings": 512,
|
||||
"model_type": "distilbert",
|
||||
"n_heads": 12,
|
||||
"n_layers": 6,
|
||||
"output_past": true,
|
||||
"pad_token_id": 0,
|
||||
"problem_type": "single_label_classification",
|
||||
"qa_dropout": 0.1,
|
||||
"seq_classif_dropout": 0.2,
|
||||
"sinusoidal_pos_embds": false,
|
||||
"tie_weights_": true,
|
||||
"tie_word_embeddings": true,
|
||||
"transformers_version": "5.15.1",
|
||||
"use_cache": false,
|
||||
"vocab_size": 119547
|
||||
}
|
||||
17
public/models/toxicity/model-manifest.json
Normal file
17
public/models/toxicity/model-manifest.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"source": "wagesj45/toxic-comment-classifier",
|
||||
"revision": "a7d2df2ead42f0bce00b330939574a02266772f5",
|
||||
"architecture": "DistilBertForSequenceClassification",
|
||||
"labels": {
|
||||
"toxic": 1,
|
||||
"nonToxic": 0,
|
||||
"names": {
|
||||
"not_toxic": 0,
|
||||
"toxic": 1
|
||||
}
|
||||
},
|
||||
"maxLength": 512,
|
||||
"quantization": "int8-dynamic",
|
||||
"runtime": "onnxruntime-web-wasm",
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
BIN
public/models/toxicity/onnx/model_quantized.onnx
(Stored with Git LFS)
Normal file
BIN
public/models/toxicity/onnx/model_quantized.onnx
(Stored with Git LFS)
Normal file
Binary file not shown.
119702
public/models/toxicity/tokenizer.json
Normal file
119702
public/models/toxicity/tokenizer.json
Normal file
File diff suppressed because it is too large
Load diff
15
public/models/toxicity/tokenizer_config.json
Normal file
15
public/models/toxicity/tokenizer_config.json
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"backend": "tokenizers",
|
||||
"cls_token": "[CLS]",
|
||||
"do_lower_case": false,
|
||||
"is_local": false,
|
||||
"local_files_only": false,
|
||||
"mask_token": "[MASK]",
|
||||
"model_max_length": 512,
|
||||
"pad_token": "[PAD]",
|
||||
"sep_token": "[SEP]",
|
||||
"strip_accents": null,
|
||||
"tokenize_chinese_chars": true,
|
||||
"tokenizer_class": "BertTokenizer",
|
||||
"unk_token": "[UNK]"
|
||||
}
|
||||
2
public/offscreen.html
Normal file
2
public/offscreen.html
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<!doctype html>
|
||||
<html><head><meta charset="utf-8"><title>VibeGuard inference</title></head><body><script type="module" src="/offscreen.js"></script></body></html>
|
||||
7
public/options.html
Normal file
7
public/options.html
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<!doctype html>
|
||||
<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>VibeGuard settings</title></head><body><main><h1>VibeGuard settings</h1><form id="settings">
|
||||
<label for="threshold">Toxicity threshold: <output id="threshold-value">80%</output></label><input id="threshold" type="range" min="0" max="1" step=".01">
|
||||
<label for="filter-mode">Filtering mode</label><select id="filter-mode"><option value="collapse">Collapse with Show button</option><option value="hide">Hide completely</option></select>
|
||||
<label><input id="show-score" type="checkbox"> Show toxicity score</label>
|
||||
<fieldset><legend>Supported sites</legend><label><input id="site-reddit" type="checkbox"> Reddit</label><label><input id="site-twitter" type="checkbox"> X/Twitter</label><label><input id="site-facebook" type="checkbox"> Facebook</label></fieldset>
|
||||
<button type="submit">Save settings</button> <span id="status" role="status"></span></form></main><script type="module" src="/options.js"></script></body></html>
|
||||
Loading…
Reference in a new issue