hynky HF staff commited on
Commit
aef3a19
1 Parent(s): 74b7f00

placeholder

Browse files
Files changed (2) hide show
  1. index.html +3 -1
  2. src/clusters.js +4 -11
index.html CHANGED
@@ -169,7 +169,9 @@
169
  <figure>
170
  <img src="banner.png" alt="FineWeb">
171
  </figure>
172
- <div id="clusters-plot"></div>
 
 
173
  </div>
174
  </d-title>
175
  <d-byline></d-byline>
 
169
  <figure>
170
  <img src="banner.png" alt="FineWeb">
171
  </figure>
172
+ <div id="clusters-plot">
173
+ <img src="plots/clusters.png" alt="Clusters">
174
+ </div>
175
  </div>
176
  </d-title>
177
  <d-byline></d-byline>
src/clusters.js CHANGED
@@ -109,15 +109,9 @@ const readData = async () => {
109
  }
110
 
111
 
112
- const showImage = (parent) => {
113
- // create the image
114
- const img = document.createElement('img');
115
- img.src = 'plots/clusters.png';
116
- img.alt = 'Clusters';
117
- parent.appendChild(img);
118
- }
119
-
120
- const destroyImage = (parent) => {
121
  const img = parent.querySelector('img');
122
  img.remove();
123
  }
@@ -125,7 +119,6 @@ const destroyImage = (parent) => {
125
  async function plotClusters() {
126
  const parent = document.getElementById('clusters-plot');
127
  // We do a little trolling on users and pretend that we already donwloaded the data by simply showing uniteractive image :)
128
- showImage(parent);
129
  const data = await readData();
130
  const traces = [{
131
  type: 'scatter',
@@ -185,7 +178,7 @@ async function plotClusters() {
185
  },
186
  };
187
 
188
- destroyImage(parent);
189
  Plotly.newPlot(parent, traces, layout);
190
 
191
  parent.on('plotly_relayout', (eventdata) => {
 
109
  }
110
 
111
 
112
+ // The cluster is pretty big, so takes time to donwload
113
+ // In the meantime we put there a placeholder image
114
+ const destroyPlaceholderImage = (parent) => {
 
 
 
 
 
 
115
  const img = parent.querySelector('img');
116
  img.remove();
117
  }
 
119
  async function plotClusters() {
120
  const parent = document.getElementById('clusters-plot');
121
  // We do a little trolling on users and pretend that we already donwloaded the data by simply showing uniteractive image :)
 
122
  const data = await readData();
123
  const traces = [{
124
  type: 'scatter',
 
178
  },
179
  };
180
 
181
+ destroyPlaceholderImage(parent);
182
  Plotly.newPlot(parent, traces, layout);
183
 
184
  parent.on('plotly_relayout', (eventdata) => {