TonyChen06 commited on
Commit
69c7116
·
1 Parent(s): 6c810d1

Add working sample loader

Browse files
Files changed (2) hide show
  1. index.html +7 -6
  2. samples.json +0 -0
index.html CHANGED
@@ -957,13 +957,14 @@ document.addEventListener('DOMContentLoaded', async () => {
957
  });
958
 
959
  document.getElementById('load-random-btn').addEventListener('click', async () => {
960
- showStatus('load-status', 'Loading from HuggingFace...', 'info');
961
  try {
962
- // Note: This would need CORS headers from HF or a proxy
963
- // For now, show instructions
964
- showStatus('load-status',
965
- 'Direct HF loading requires CORS. Download the dataset and paste JSON here.',
966
- 'info');
 
967
  } catch (err) {
968
  showStatus('load-status', err.message, 'error');
969
  }
 
957
  });
958
 
959
  document.getElementById('load-random-btn').addEventListener('click', async () => {
960
+ showStatus('load-status', 'Loading sample...', 'info');
961
  try {
962
+ const resp = await fetch('samples.json');
963
+ if (!resp.ok) throw new Error('Failed to load samples.json');
964
+ const samples = await resp.json();
965
+ const randomSample = samples[Math.floor(Math.random() * samples.length)];
966
+ loadAndReplay([randomSample]);
967
+ showStatus('load-status', `Loaded ${randomSample.gameType} sample`, 'success');
968
  } catch (err) {
969
  showStatus('load-status', err.message, 'error');
970
  }
samples.json ADDED
The diff for this file is too large to render. See raw diff