Use locally-hosted GPT-2 model to fix CORS over Tor/onion origins

This commit is contained in:
Laan Tungir
2026-06-28 20:45:25 -04:00
parent 3ec585273f
commit b6e945f8de
3 changed files with 11 additions and 4 deletions

3
.gitignore vendored
View File

@@ -1,3 +1,6 @@
# GPT-2 model files (271MB, too large for git — uploaded directly to server)
www/models/
hamburger_morphing/ hamburger_morphing/
client/ client/
ndk/ ndk/

View File

@@ -1,5 +1,5 @@
{ {
"VERSION": "v0.7.63", "VERSION": "v0.7.64",
"VERSION_NUMBER": "0.7.63", "VERSION_NUMBER": "0.7.64",
"BUILD_DATE": "2026-06-29T00:32:50.824Z" "BUILD_DATE": "2026-06-29T00:45:25.458Z"
} }

View File

@@ -1542,8 +1542,12 @@
} from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.0.0"; } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.0.0";
import { encode, decode } from "./js/stego.mjs"; import { encode, decode } from "./js/stego.mjs";
// Use locally-hosted model files (./models/Xenova/gpt2/) so the page
// works over Tor/onion origins where HuggingFace CORS is blocked.
const MODEL_ID = "Xenova/gpt2"; const MODEL_ID = "Xenova/gpt2";
env.allowLocalModels = false; env.allowLocalModels = true;
env.localModelPath = "./models/";
env.allowRemoteModels = false;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// DOM references // DOM references