Spaces:
Runtime error
Runtime error
| const https = require('https'); | |
| const models = [ | |
| 'adirik/grounding-dino' | |
| ]; | |
| async function checkModel(modelId) { | |
| return new Promise((resolve) => { | |
| const options = { | |
| hostname: 'api.replicate.com', | |
| path: `/v1/models/${modelId}`, | |
| method: 'GET', | |
| headers: { | |
| 'Authorization': `Bearer ${process.env.REPLICATE_API_KEY}`, | |
| 'User-Agent': 'Node.js' | |
| } | |
| }; | |
| const req = https.request(options, (res) => { | |
| if (res.statusCode === 200) { | |
| let data = ''; | |
| res.on('data', chunk => data += chunk); | |
| res.on('end', () => { | |
| const json = JSON.parse(data); | |
| console.log(`✅ Model found: ${modelId}`); | |
| console.log(`Latest Version Hash: ${json.latest_version?.id}`); | |
| resolve(true); | |
| }); | |
| } else { | |
| console.log(`❌ Model not found: ${modelId} (Status: ${res.statusCode})`); | |
| resolve(false); | |
| } | |
| }); | |
| req.on('error', (e) => { | |
| console.error(`Error checking ${modelId}: ${e.message}`); | |
| resolve(false); | |
| }); | |
| req.end(); | |
| }); | |
| } | |
| async function main() { | |
| for (const model of models) { | |
| await checkModel(model); | |
| } | |
| } | |
| main(); | |