Molbap HF Staff commited on
Commit
aa6453c
·
1 Parent(s): cd31d26
Files changed (1) hide show
  1. modular_graph_and_candidates.py +20 -3
modular_graph_and_candidates.py CHANGED
@@ -531,7 +531,7 @@ function updateVisibility() {
531
  }
532
  document.getElementById('toggleRed').addEventListener('change', updateVisibility);
533
 
534
- const HF_LOGO_URI = "./static/hf-logo.svg";
535
  const graph = __GRAPH_DATA__;
536
  const W = innerWidth, H = innerHeight;
537
  const svg = d3.select('#dependency').call(d3.zoom().on('zoom', e => g.attr('transform', e.transform)));
@@ -556,13 +556,30 @@ const node = g.selectAll('g.node')
556
 
557
  const baseSel = node.filter(d => d.cls === 'base');
558
  if (HF_LOGO_URI){
559
- baseSel.append('image').attr('href', HF_LOGO_URI);
 
 
 
 
 
 
 
 
 
 
 
 
560
  }else{
561
  baseSel.append('circle').attr('r', d => 22*d.sz).attr('fill', '#ffbe0b');
562
  }
563
  node.filter(d => d.cls !== 'base').append('circle').attr('r', d => 20*d.sz);
564
 
565
- node.append('text').attr('class','node-label').attr('dy','-2.4em').text(d => d.id);
 
 
 
 
 
566
 
567
  const sim = d3.forceSimulation(graph.nodes)
568
  .force('link', d3.forceLink(graph.links).id(d => d.id).distance(520))
 
531
  }
532
  document.getElementById('toggleRed').addEventListener('change', updateVisibility);
533
 
534
+ const HF_LOGO_URI = "./static/hf-logo.png";
535
  const graph = __GRAPH_DATA__;
536
  const W = innerWidth, H = innerHeight;
537
  const svg = d3.select('#dependency').call(d3.zoom().on('zoom', e => g.attr('transform', e.transform)));
 
556
 
557
  const baseSel = node.filter(d => d.cls === 'base');
558
  if (HF_LOGO_URI){
559
+ baseSel.append('image')
560
+ .attr('href', HF_LOGO_URI)
561
+ .attr('width', 40)
562
+ .attr('height', 40)
563
+ .attr('x', -20)
564
+ .attr('y', -20)
565
+ .on('error', function() {
566
+ console.log('Image failed to load:', HF_LOGO_URI);
567
+ // Fallback to circle
568
+ d3.select(this.parentNode).append('circle')
569
+ .attr('r', 22).attr('fill', '#ffbe0b');
570
+ });
571
+ console.log('Loading logo from:', HF_LOGO_URI);
572
  }else{
573
  baseSel.append('circle').attr('r', d => 22*d.sz).attr('fill', '#ffbe0b');
574
  }
575
  node.filter(d => d.cls !== 'base').append('circle').attr('r', d => 20*d.sz);
576
 
577
+ node.append('text')
578
+ .attr('class','node-label')
579
+ .attr('dy','-2.4em')
580
+ .style('font-size', d => d.cls === 'base' ? '16px' : '14px')
581
+ .style('font-weight', d => d.cls === 'base' ? 'bold' : 'normal')
582
+ .text(d => d.id);
583
 
584
  const sim = d3.forceSimulation(graph.nodes)
585
  .force('link', d3.forceLink(graph.links).id(d => d.id).distance(520))