Spaces:
Running
Running
CrispStrobe commited on
Commit ·
302ab7f
1
Parent(s): 644a44f
feat: add sync-hf script to handle metadata injection and clean up README
Browse files- README.md +0 -9
- package.json +1 -0
- scripts/sync-hf.js +47 -0
README.md
CHANGED
|
@@ -1,12 +1,3 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: LLM Providers
|
| 3 |
-
emoji: 🌍
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: indigo
|
| 6 |
-
short_description: Compare pricing, capabilities, benchmark scores, EU focus.
|
| 7 |
-
sdk: docker
|
| 8 |
-
pinned: false
|
| 9 |
-
---
|
| 10 |
# LLM Providers
|
| 11 |
|
| 12 |
**Live: [llmproviders.vercel.app](https://llmproviders.vercel.app) or [Hugging Face Space](https://huggingface.co/spaces/cstr/LLMProviders)**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# LLM Providers
|
| 2 |
|
| 3 |
**Live: [llmproviders.vercel.app](https://llmproviders.vercel.app) or [Hugging Face Space](https://huggingface.co/spaces/cstr/LLMProviders)**
|
package.json
CHANGED
|
@@ -20,6 +20,7 @@
|
|
| 20 |
"fetch:ionos": "node scripts/providers/ionos.js",
|
| 21 |
"fetch:bfl": "node scripts/providers/black-forest-labs.js",
|
| 22 |
"fetch:benchmarks": "node scripts/fetch-benchmarks.js",
|
|
|
|
| 23 |
"server": "node server.js",
|
| 24 |
"dev:api": "node server.js"
|
| 25 |
},
|
|
|
|
| 20 |
"fetch:ionos": "node scripts/providers/ionos.js",
|
| 21 |
"fetch:bfl": "node scripts/providers/black-forest-labs.js",
|
| 22 |
"fetch:benchmarks": "node scripts/fetch-benchmarks.js",
|
| 23 |
+
"push:hf": "node scripts/sync-hf.js",
|
| 24 |
"server": "node server.js",
|
| 25 |
"dev:api": "node server.js"
|
| 26 |
},
|
scripts/sync-hf.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
const { execSync } = require('child_process');
|
| 4 |
+
const fs = require('fs');
|
| 5 |
+
const path = require('path');
|
| 6 |
+
|
| 7 |
+
const ROOT = path.join(__dirname, '..');
|
| 8 |
+
const SPACE_YML = path.join(ROOT, '.huggingface', 'space.yml');
|
| 9 |
+
const README = path.join(ROOT, 'README.md');
|
| 10 |
+
|
| 11 |
+
function run(cmd) {
|
| 12 |
+
console.log(`> ${cmd}`);
|
| 13 |
+
return execSync(cmd, { stdio: 'inherit', cwd: ROOT });
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
async function main() {
|
| 17 |
+
console.log('Syncing to Hugging Face Space...');
|
| 18 |
+
|
| 19 |
+
if (!fs.existsSync(SPACE_YML)) {
|
| 20 |
+
console.error('Error: .huggingface/space.yml not found');
|
| 21 |
+
process.exit(1);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
// 1. Create the HF version of README
|
| 25 |
+
const metadata = fs.readFileSync(SPACE_YML, 'utf8');
|
| 26 |
+
const content = fs.readFileSync(README, 'utf8');
|
| 27 |
+
fs.writeFileSync(README, metadata + '\n' + content);
|
| 28 |
+
|
| 29 |
+
try {
|
| 30 |
+
// 2. Commit and Push
|
| 31 |
+
run('git add README.md');
|
| 32 |
+
run('git commit -m "chore: sync to Hugging Face with metadata [skip ci]"');
|
| 33 |
+
run('git push hf main --force');
|
| 34 |
+
console.log('\n✓ Successfully pushed to Hugging Face Space.');
|
| 35 |
+
} catch (err) {
|
| 36 |
+
console.error('\n✗ Failed to push to Hugging Face.');
|
| 37 |
+
} finally {
|
| 38 |
+
// 3. Revert the local commit and README change
|
| 39 |
+
console.log('\nRestoring local README...');
|
| 40 |
+
run('git reset --hard HEAD~1');
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
main().catch(err => {
|
| 45 |
+
console.error(err);
|
| 46 |
+
process.exit(1);
|
| 47 |
+
});
|