From 98e1e175da707d8a3564b6b17c88793cde839d47 Mon Sep 17 00:00:00 2001 From: Zaid Alyafeai Date: Fri, 19 Jul 2024 15:43:16 +0000 Subject: [PATCH] check the viewer --- assets/js/index.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/assets/js/index.js b/assets/js/index.js index fe0bd34..b502ae7 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -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 `` + var dataset_name = hf_link.split('datasets/')[1] + var viewer = await getViewer(dataset_name) + if (viewer['viewer']){ + return `` + } + else + return '' } async function fomratDetails(data, index) { @@ -177,7 +190,7 @@ async function fomratDetails(data, index) { 'Details' + 'Paper' + '' + - create_hf_viewer(data['HF Link'])+ + await create_hf_viewer(data['HF Link'])+ '' // })