Skip to content

Commit c40c984

Browse files
TheSeriousProgrammerTheSeriousProgrammer
authored andcommitted
fix: use relative paths for models and assets to support GitHub Pages subpaths
1 parent 86f95b3 commit c40c984

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/components/CreateTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const CreateTab: React.FC<CreateTabProps> = ({ onStatusChange, audioUtils }) =>
3636
// Initialize model session
3737
const getModelSession = async () => {
3838
if (!modelSessionRef.current) {
39-
modelSessionRef.current = await ort.InferenceSession.create('/models/model.onnx', {
39+
modelSessionRef.current = await ort.InferenceSession.create('models/model.onnx', {
4040
executionProviders: ['wasm'],
4141
graphOptimizationLevel: 'all'
4242
});

src/components/TestTab.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const TestTab: React.FC<TestTabProps> = ({ onStatusChange, audioUtils }) => {
4747
onStatusChange('Loading ONNX model...');
4848

4949
if (!modelSessionRef.current) {
50-
const session = await ort.InferenceSession.create('/models/model.onnx', {
50+
const session = await ort.InferenceSession.create('models/model.onnx', {
5151
executionProviders: ['wasm'],
5252
graphOptimizationLevel: 'all'
5353
});
@@ -62,7 +62,7 @@ const TestTab: React.FC<TestTabProps> = ({ onStatusChange, audioUtils }) => {
6262
if (customRef) {
6363
referenceEmbeddingsRef.current = customRef.embeddings;
6464
} else {
65-
const response = await fetch(`/models/${selectedWord}_ref.json`);
65+
const response = await fetch(`models/${selectedWord}_ref.json`);
6666
const data = await response.json();
6767
referenceEmbeddingsRef.current = data.embeddings;
6868
}
@@ -97,7 +97,7 @@ const TestTab: React.FC<TestTabProps> = ({ onStatusChange, audioUtils }) => {
9797
const audioContext = new AudioContext({ sampleRate: 16000 });
9898
audioContextRef.current = audioContext;
9999

100-
await audioContext.audioWorklet.addModule('/audio-processor.js');
100+
await audioContext.audioWorklet.addModule('audio-processor.js');
101101
const micSource = audioContext.createMediaStreamSource(stream);
102102
const processorNode = new AudioWorkletNode(audioContext, 'audio-processor');
103103

0 commit comments

Comments
 (0)