Spaces:
Running
Running
David Pomerenke
commited on
Commit
·
dd24d65
1
Parent(s):
430bde6
Minor table formatting
Browse files
frontend/src/components/DatasetTable.js
CHANGED
|
@@ -43,6 +43,12 @@ const DatasetTable = ({ data }) => {
|
|
| 43 |
return <a href={rowData.url} target='_blank' style={{ textDecoration: 'none', color: 'inherit' }}><i className='pi pi-external-link' style={{ fontSize: '0.8rem' }} /></a>
|
| 44 |
}
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
const tasks = [...new Set(table.flatMap(item => item.tasks))].sort()
|
| 47 |
const tasksRowFilterTemplate = options => {
|
| 48 |
return (
|
|
@@ -61,7 +67,6 @@ const DatasetTable = ({ data }) => {
|
|
| 61 |
)
|
| 62 |
}
|
| 63 |
|
| 64 |
-
console.log(table)
|
| 65 |
return (
|
| 66 |
<DataTable
|
| 67 |
value={table}
|
|
@@ -115,6 +120,7 @@ const DatasetTable = ({ data }) => {
|
|
| 115 |
filter
|
| 116 |
sortable
|
| 117 |
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
|
|
|
| 118 |
/>
|
| 119 |
</DataTable>
|
| 120 |
)
|
|
|
|
| 43 |
return <a href={rowData.url} target='_blank' style={{ textDecoration: 'none', color: 'inherit' }}><i className='pi pi-external-link' style={{ fontSize: '0.8rem' }} /></a>
|
| 44 |
}
|
| 45 |
|
| 46 |
+
const nLanguagesBodyTemplate = rowData => {
|
| 47 |
+
return <div style={{ textAlign: 'center' }}>
|
| 48 |
+
{rowData.n_languages}
|
| 49 |
+
</div>
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
const tasks = [...new Set(table.flatMap(item => item.tasks))].sort()
|
| 53 |
const tasksRowFilterTemplate = options => {
|
| 54 |
return (
|
|
|
|
| 67 |
)
|
| 68 |
}
|
| 69 |
|
|
|
|
| 70 |
return (
|
| 71 |
<DataTable
|
| 72 |
value={table}
|
|
|
|
| 120 |
filter
|
| 121 |
sortable
|
| 122 |
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
| 123 |
+
body={nLanguagesBodyTemplate}
|
| 124 |
/>
|
| 125 |
</DataTable>
|
| 126 |
)
|
frontend/src/components/LanguageTable.js
CHANGED
|
@@ -14,7 +14,8 @@ const LanguageTable = ({ data }) => {
|
|
| 14 |
})
|
| 15 |
const table = data.language_table
|
| 16 |
|
| 17 |
-
const families = [...new Set(table.map(item => item.family))]
|
|
|
|
| 18 |
const familyRowFilterTemplate = options => {
|
| 19 |
return (
|
| 20 |
<MultiSelect
|
|
@@ -37,10 +38,14 @@ const LanguageTable = ({ data }) => {
|
|
| 37 |
return ''
|
| 38 |
} else if (population < 1000) {
|
| 39 |
return population.toFixed(0) + ''
|
| 40 |
-
} else if (population <
|
| 41 |
return (population / 1000).toFixed(1) + 'K'
|
| 42 |
-
} else if (population < 1000 * 1000
|
|
|
|
|
|
|
| 43 |
return (population / 1000 / 1000).toFixed(1) + 'M'
|
|
|
|
|
|
|
| 44 |
} else {
|
| 45 |
return (population / 1000 / 1000 / 1000).toFixed(1) + 'B'
|
| 46 |
}
|
|
@@ -48,8 +53,8 @@ const LanguageTable = ({ data }) => {
|
|
| 48 |
|
| 49 |
const SliderWithLabel = ({ value, onChange }) => {
|
| 50 |
const p = 10
|
| 51 |
-
const min =
|
| 52 |
-
const max =
|
| 53 |
const start = value === null ? min : Math.log(value[0]) / Math.log(p)
|
| 54 |
const stop = value === null ? max : Math.log(value[1]) / Math.log(p)
|
| 55 |
const [_value, _setValue] = useState([start, stop])
|
|
@@ -99,7 +104,7 @@ const LanguageTable = ({ data }) => {
|
|
| 99 |
|
| 100 |
const speakerBodyTemplate = rowData => {
|
| 101 |
const populationStr = formatPopulation(rowData.speakers)
|
| 102 |
-
return <div style={{ textAlign: '
|
| 103 |
}
|
| 104 |
|
| 105 |
const languageBodyTemplate = rowData => {
|
|
@@ -136,7 +141,7 @@ const LanguageTable = ({ data }) => {
|
|
| 136 |
/>
|
| 137 |
<Column
|
| 138 |
field='speakers'
|
| 139 |
-
header='Speakers'
|
| 140 |
body={speakerBodyTemplate}
|
| 141 |
filter
|
| 142 |
filterElement={speakerFilterTemplate}
|
|
|
|
| 14 |
})
|
| 15 |
const table = data.language_table
|
| 16 |
|
| 17 |
+
const families = [...new Set(table.map(item => item.family))].slice(0, 10)
|
| 18 |
+
families.push("Other")
|
| 19 |
const familyRowFilterTemplate = options => {
|
| 20 |
return (
|
| 21 |
<MultiSelect
|
|
|
|
| 38 |
return ''
|
| 39 |
} else if (population < 1000) {
|
| 40 |
return population.toFixed(0) + ''
|
| 41 |
+
} else if (population < 10 * 1000) {
|
| 42 |
return (population / 1000).toFixed(1) + 'K'
|
| 43 |
+
} else if (population < 1000 * 1000) {
|
| 44 |
+
return (population / 1000).toFixed(0) + 'K'
|
| 45 |
+
} else if (population < 10 * 1000 * 1000) {
|
| 46 |
return (population / 1000 / 1000).toFixed(1) + 'M'
|
| 47 |
+
}else if (population < 1000 * 1000 * 1000) {
|
| 48 |
+
return (population / 1000 / 1000).toFixed(0) + 'M'
|
| 49 |
} else {
|
| 50 |
return (population / 1000 / 1000 / 1000).toFixed(1) + 'B'
|
| 51 |
}
|
|
|
|
| 53 |
|
| 54 |
const SliderWithLabel = ({ value, onChange }) => {
|
| 55 |
const p = 10
|
| 56 |
+
const min = 4
|
| 57 |
+
const max = 9.3
|
| 58 |
const start = value === null ? min : Math.log(value[0]) / Math.log(p)
|
| 59 |
const stop = value === null ? max : Math.log(value[1]) / Math.log(p)
|
| 60 |
const [_value, _setValue] = useState([start, stop])
|
|
|
|
| 104 |
|
| 105 |
const speakerBodyTemplate = rowData => {
|
| 106 |
const populationStr = formatPopulation(rowData.speakers)
|
| 107 |
+
return <div style={{ textAlign: 'center' }}>{populationStr}</div>
|
| 108 |
}
|
| 109 |
|
| 110 |
const languageBodyTemplate = rowData => {
|
|
|
|
| 141 |
/>
|
| 142 |
<Column
|
| 143 |
field='speakers'
|
| 144 |
+
header={<i className='pi pi-users' title='Speakers' />}
|
| 145 |
body={speakerBodyTemplate}
|
| 146 |
filter
|
| 147 |
filterElement={speakerFilterTemplate}
|
frontend/src/components/ModelTable.js
CHANGED
|
@@ -103,11 +103,21 @@ const ModelTable = ({ data }) => {
|
|
| 103 |
|
| 104 |
const sizeBodyTemplate = rowData => {
|
| 105 |
const sizeStr = formatSize(rowData.size)
|
| 106 |
-
return <div style={{ textAlign: '
|
| 107 |
}
|
| 108 |
|
| 109 |
const modelBodyTemplate = rowData => {
|
| 110 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
}
|
| 112 |
|
| 113 |
const scoreBodyTemplate = (field, options = {}) => {
|
|
@@ -132,11 +142,7 @@ const ModelTable = ({ data }) => {
|
|
| 132 |
id='model-table'
|
| 133 |
>
|
| 134 |
<Column field='rank' body={rankBodyTemplate} />
|
| 135 |
-
<Column
|
| 136 |
-
field='provider'
|
| 137 |
-
header='Provider'
|
| 138 |
-
style={{ minWidth: '5rem' }}
|
| 139 |
-
/>
|
| 140 |
<Column
|
| 141 |
field='model'
|
| 142 |
header='Model'
|
|
@@ -146,15 +152,15 @@ const ModelTable = ({ data }) => {
|
|
| 146 |
/>
|
| 147 |
<Column
|
| 148 |
field='type'
|
| 149 |
-
header='
|
| 150 |
filter
|
| 151 |
filterElement={typeRowFilterTemplate}
|
| 152 |
showFilterMatchModes={false}
|
| 153 |
-
|
| 154 |
/>
|
| 155 |
<Column
|
| 156 |
field='size'
|
| 157 |
-
header=
|
| 158 |
filter
|
| 159 |
filterElement={sizeFilterTemplate}
|
| 160 |
showFilterMatchModes={false}
|
|
|
|
| 103 |
|
| 104 |
const sizeBodyTemplate = rowData => {
|
| 105 |
const sizeStr = formatSize(rowData.size)
|
| 106 |
+
return <div style={{ textAlign: 'center' }}>{sizeStr}</div>
|
| 107 |
}
|
| 108 |
|
| 109 |
const modelBodyTemplate = rowData => {
|
| 110 |
+
return (
|
| 111 |
+
<div style={{ fontWeight: 'bold', height: '100%' }}>{rowData.model}</div>
|
| 112 |
+
)
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
const typeBodyTemplate = rowData => {
|
| 116 |
+
return rowData.type === 'Open' ? (
|
| 117 |
+
<i className='pi pi-lock-open' title='Open weights' />
|
| 118 |
+
) : (
|
| 119 |
+
<i className='pi pi-lock' title='API only' />
|
| 120 |
+
)
|
| 121 |
}
|
| 122 |
|
| 123 |
const scoreBodyTemplate = (field, options = {}) => {
|
|
|
|
| 142 |
id='model-table'
|
| 143 |
>
|
| 144 |
<Column field='rank' body={rankBodyTemplate} />
|
| 145 |
+
<Column field='provider' header='Provider' style={{ minWidth: '5rem' }} />
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
<Column
|
| 147 |
field='model'
|
| 148 |
header='Model'
|
|
|
|
| 152 |
/>
|
| 153 |
<Column
|
| 154 |
field='type'
|
| 155 |
+
header={<i className='pi pi-unlock' title='Open weights / API only' />}
|
| 156 |
filter
|
| 157 |
filterElement={typeRowFilterTemplate}
|
| 158 |
showFilterMatchModes={false}
|
| 159 |
+
body={typeBodyTemplate}
|
| 160 |
/>
|
| 161 |
<Column
|
| 162 |
field='size'
|
| 163 |
+
header={null}
|
| 164 |
filter
|
| 165 |
filterElement={sizeFilterTemplate}
|
| 166 |
showFilterMatchModes={false}
|
frontend/src/index.css
CHANGED
|
@@ -19,6 +19,7 @@ html, body, #root {
|
|
| 19 |
|
| 20 |
.p-datatable-wrapper {
|
| 21 |
scrollbar-color: #f0f0f0 rgba(0, 0, 0, 0);
|
|
|
|
| 22 |
}
|
| 23 |
|
| 24 |
#model-table {
|
|
|
|
| 19 |
|
| 20 |
.p-datatable-wrapper {
|
| 21 |
scrollbar-color: #f0f0f0 rgba(0, 0, 0, 0);
|
| 22 |
+
border-radius: 0 0 10px 10px;
|
| 23 |
}
|
| 24 |
|
| 25 |
#model-table {
|