Skip to content

Commit

Permalink
add a few more and update (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
zachcp authored Jan 6, 2025
1 parent 358a83f commit ee53c67
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 27 deletions.
2 changes: 2 additions & 0 deletions src/components/hardware.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ export function hardware_plot(hardware, { width, height } = {}) {
grid: true,
label: "RAM (GB)",
nice: true,
domain: [0, 140],
},
x: {
grid: true,
label: "Release Date",
type: "time",
nice: true,
domain: [new Date("2020-01-01"), new Date("2025-01-01")],
},
marks: [
Plot.dot(data),
Expand Down
90 changes: 72 additions & 18 deletions src/components/protein_table.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
//

import * as Inputs from "npm:@observablehq/inputs";
import * as Plot from "npm:@observablehq/plot";
import * as d3 from "npm:d3";
import { html } from "npm:htl";
import { parseDate, parseMemorySize } from "./utiities.js";
// import * as Academicons from "npm:academicons";
// import * as FontAwesome from "npm:font-awesome-icons";
// import { hf_icon } from "./utilities.js";

// Process individual fields
function processName(row) {
return row;
}
Expand Down Expand Up @@ -92,6 +86,60 @@ function processLicense(row) {
}

function processHuggingFace(row) {
if (!row.HuggingFace) return row;

if (typeof row.HuggingFace !== "string") return row;

let icon;
if (row.HuggingFace.includes("/")) {
row.HuggingFace = html`<a
href="https://huggingface.co/${row.HuggingFace}"
target="_blank"
>${row.HuggingFace}</a
>`;
}

return row;
}

function processLinks(row) {
let links = [];

// Process Publication URL
if (row.Publication_URL && typeof row.Publication_URL === "string") {
let icon;
if (row.Publication_URL.includes("pubmed")) {
icon = html`<i class="ai ai-pubmed ai-2x"></i>`;
} else if (row.Publication_URL.includes("biorxiv")) {
icon = html`<i class="ai ai-biorxiv ai-2x"></i>`;
} else if (row.Publication_URL.includes("arxiv")) {
icon = html`<i class="ai ai-arxiv ai-2x"></i>`;
} else {
icon = html`<i class="fa fa-file"></i>`;
}
links.push(
html`<a href="${row.Publication_URL}" target="_blank">${icon}</a>`,
);
}

// Process Source URL
if (row.SourceURL && typeof row.SourceURL === "string") {
let icon;
if (row.SourceURL.includes("github")) {
icon = html`<i class="fa fa-github fa-2x"></i>`;
} else if (row.SourceURL.includes("gitlab")) {
icon = html`<i class="fa fa-gitlab fa-2x"></i>`;
} else {
icon = html`<i class="fa fa-code fa-2x"></i>`;
}
links.push(html`<a href="${row.SourceURL}" target="_blank">${icon}</a>`);
}

// Combine links with spacing
row.Links = html`<div style="display: flex; gap: 10px; align-items: center;">
${links}
</div>`;

return row;
}

Expand All @@ -101,16 +149,17 @@ function process_models(data) {
data
// .map((row) => processName(row))
.map((row) => processPublication(row))
.map((row) => processPublicationURL(row))
// .map((row) => processPublicationURL(row))
// .map((row) => processPublicationDate(row))
// .map((row) => processVersion(row))
.map((row) => processSourceURL(row))
// .map((row) => processWeightURL(row))
// .map((row) => processTotalWeightsSize(row))
// .map((row) => processArchitecture(row))
// .map((row) => processTrainingDataSize(row))
// .map((row) => processLicense(row))
// .map((row) => processHuggingFace(row))
// .map((row) => processSourceURL(row))
// .map((row) => processWeightURL(row))
// .map((row) => processTotalWeightsSize(row))
// .map((row) => processArchitecture(row))
// .map((row) => processTrainingDataSize(row))
// .map((row) => processLicense(row))
.map((row) => processHuggingFace(row))
.map((row) => processLinks(row))
);
}

Expand All @@ -121,15 +170,18 @@ export function protein_model_table(
let data = process_models(models);
console.log(data);
return Inputs.table(data, {
rows: 25,
columns: [
"Name",
"Publication",
"Publication_URL",
"SourceURL",
"WeightURL",
// "Publication_URL",
// "SourceURL",
// "WeightURL",
"TotalWeightsSize",
"Architecture",
"License",
"Links",
"HuggingFace",
],
names: {
Publication_URL: "pubURL",
Expand All @@ -139,6 +191,8 @@ export function protein_model_table(
format: {
Publication_URL: (d) => d,
SourceURL: (d) => d,
Links: (d) => d,
HuggingFace: (d) => d,
},
});
}
17 changes: 17 additions & 0 deletions src/components/utiities.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/data/desktop_hardware.csv
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Apple,M2 Ultra,64GB,Jun 2023,192GB,24 (16P+8E),60/76,3.68(P)/2.4(E),1.398
Apple,M3,8GB,Oct 2023,24GB,8 (4P+4E),10,4.05(P)/2.7(E),1.5
Apple,M3 Pro,18GB,Oct 2023,36GB,12 (6P+6E),18,4.05(P)/2.7(E),1.5
Apple,M3 Max,36GB,Oct 2023,128GB,16 (12P+4E),40,4.05(P)/2.7(E),1.5
Tinygrad,Tinybox Green,128GB,Oct 2024,,,,,
Loading

0 comments on commit ee53c67

Please sign in to comment.