Skip to content

Commit e8e2304

Browse files
severoplatypii
andauthored
Support huggingface source (#343)
* add HF source from the space repository * fix style * fix imports * add tests about no support for models and spaces * simplify a bit * simplify * support space URLs * support models * fix focus color * simplify the tests a bit * move type definitions to the top, and don't export them * vendor listFiles from @huggingface/hub * Update test/lib/sources/huggingFaceSource.test.ts Co-authored-by: Kenny Daniel <platypii@gmail.com> * import it --------- Co-authored-by: Kenny Daniel <platypii@gmail.com>
1 parent 81fdaf3 commit e8e2304

File tree

5 files changed

+580
-2
lines changed

5 files changed

+580
-2
lines changed

src/components/App/App.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useMemo } from 'react'
22
import { Config, ConfigProvider } from '../../hooks/useConfig.js'
33
import { getHttpSource } from '../../lib/sources/httpSource.js'
4+
import { getHuggingFaceSource } from '../../lib/sources/huggingFaceSource.js'
45
import { getHyperparamSource } from '../../lib/sources/hyperparamSource.js'
56
import Page from '../Page/Page.js'
67

@@ -10,7 +11,9 @@ export default function App() {
1011
const row = search.get('row') === null ? undefined : Number(search.get('row'))
1112
const col = search.get('col') === null ? undefined : Number(search.get('col'))
1213

13-
const source = getHttpSource(sourceId) ?? getHyperparamSource(sourceId, { endpoint: location.origin })
14+
const source = getHuggingFaceSource(sourceId) ??
15+
getHttpSource(sourceId) ??
16+
getHyperparamSource(sourceId, { endpoint: location.origin })
1417

1518
// Memoize the config to avoid creating a new object on each render
1619
const config: Config = useMemo(() => ({

src/components/Breadcrumb/Breadcrumb.module.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
min-height: 32px;
1616
border-bottom: 1px solid #ddd;
1717
background: var(--color-background-dark);
18-
padding: 0 10px 0 20px;
18+
padding: 0 20px;
1919
border-radius: var(--border-radius-lg);
2020
margin: var(--space-3xs);
2121
/* TODO(SL): forbid overflow? */
@@ -56,6 +56,13 @@
5656

5757
.versions {
5858
padding-left: 4px;
59+
& > button {
60+
color: #eee;
61+
62+
&:hover, &:focus {
63+
color: #fff
64+
}
65+
}
5966

6067
[aria-current] {
6168
font-weight: bold;

0 commit comments

Comments
 (0)