Spaces:
Running
Running
import requests | |
import json | |
# Fetch available models from Hugging Face router | |
response = requests.get("https://router.huggingface.co/v1/models") | |
models = response.json() | |
print(f"Found {len(models['data'])} models:") | |
for model in models['data']: | |
print(f"- {model['id']}") | |
# Save to file for later use | |
with open('models.json', 'w') as f: | |
json.dump(models, f, indent=2) |