Skip to content

Commit

Permalink
Don't update -, lowercase on website
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwgillespie committed Jan 6, 2025
1 parent 359a5de commit fe250f5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bin/build-and-push-model
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tag=${3:-latest}

annotations="annotation.org.opencontainers.image.revision=${sha},annotation.org.opencontainers.image.source=https://huggingface.co/${name},annotation-index.org.opencontainers.image.revision=${sha},annotation-index.org.opencontainers.image.source=https://huggingface.co/${name},annotation-manifest-descriptor.org.opencontainers.image.revision=${sha},annotation-manifest-descriptor.org.opencontainers.image.source=https://huggingface.co/${name}"

normalized="$(echo "$name" | tr '[:upper:]' '[:lower:]' | tr '.' '-')"
normalized="$(echo "$name" | tr '[:upper:]' '[:lower:]')"

depot build . \
-f "${SCRIPT_DIR}/../models/Dockerfile" \
Expand Down
2 changes: 1 addition & 1 deletion models/top.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function getTopHuggingFaceModels(topN: number): Promise<Model[]> {
}

const data: HuggingFaceModel[] = await response.json()
return data.map(({id, sha}) => ({name: id.toLowerCase().replaceAll('.', '-'), sha, tagAs: 'latest'}))
return data.map(({id, sha}) => ({name: id.toLowerCase(), sha, tagAs: 'latest'}))
}

async function main() {
Expand Down
10 changes: 6 additions & 4 deletions website/src/components/Model.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {cx} from 'class-variance-authority'
import {SVGProps, useCallback, useEffect, useState} from 'react'
import {SVGProps, useCallback, useEffect, useMemo, useState} from 'react'
import {useCopyToClipboard} from '../hooks/useCopyToClipboard'

export interface ModelProps {
Expand All @@ -20,9 +20,11 @@ export function Model({name, sha, tagAs}: ModelProps) {
return () => clearTimeout(timeout)
}, [value])

const normalizedName = useMemo(() => name.toLowerCase(), [name])

const copyImage = useCallback(() => {
copy(`COPY --link --from=depot.ai/${name}:${tagAs} / .`)
}, [name, tagAs])
copy(`COPY --link --from=depot.ai/${normalizedName}:${tagAs} / .`)
}, [normalizedName, tagAs])

return (
<div className="bg-radix-mauve1 border border-radix-mauve6 px-4 rounded-lg gap-2 flex items-center leading-none justify-between">
Expand All @@ -36,7 +38,7 @@ export function Model({name, sha, tagAs}: ModelProps) {
/>
<div className="tracking-tight whitespace-nowrap md:text-lg py-4 overflow-x-scroll md:overflow-x-hidden overflow-y-hidden">
<span className="text-radix-mauve11">depot.ai/</span>
{name}
{normalizedName}
<span className="text-radix-mauve11">:{tagAs}</span>
</div>
</button>
Expand Down

0 comments on commit fe250f5

Please sign in to comment.