Skip to content

Commit

Permalink
check the viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
zaidalyafeai committed Jul 19, 2024
1 parent 8b7695c commit 98e1e17
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,24 @@ async function getOGimage(url) {
return "./assets/images/logo.png"
}

function create_hf_viewer(hf_link){
async function getViewer(dataset_name) {
console.log(dataset_name)
console.log(`https://datasets-server.huggingface.co/is-valid?dataset=${dataset_name}`)
return axios.get(`https://datasets-server.huggingface.co/is-valid?dataset=${dataset_name}`).then(response => response.data)
}

async function create_hf_viewer(hf_link){

if (hf_link.toString() == 'nan')
return ''
else
return `<iframe src="${hf_link}/embed/viewer" frameborder="0" width="100%" height="560px"></iframe>`
var dataset_name = hf_link.split('datasets/')[1]
var viewer = await getViewer(dataset_name)
if (viewer['viewer']){
return `<iframe src="${hf_link}/embed/viewer" frameborder="0" width="100%" height="560px"></iframe>`
}
else
return ''
}

async function fomratDetails(data, index) {
Expand Down Expand Up @@ -177,7 +190,7 @@ async function fomratDetails(data, index) {
'<a href="' + `card?id=${index}` + '" class="underline font-normal">Details</a>' +
'<a href="' + data["Paper Link"] + '" target="_blank" class="underline font-normal">Paper</a>' +
'</div>' +
create_hf_viewer(data['HF Link'])+
await create_hf_viewer(data['HF Link'])+

'</div>'
// })
Expand Down

0 comments on commit 98e1e17

Please sign in to comment.