Spaces:
Runtime error
Runtime error
Download scratch/test_models.py from Vinoth-46/YT-Automation: direct link, hf CLI and curl.
- Browser
- Download file 815 Bytes
-
https://huggingface.co/spaces/Vinoth-46/YT-Automation/resolve/main/scratch/test_models.py
- Command line
-
hf download hf://spaces/Vinoth-46/YT-Automation/scratch/test_models.py
-
curl -L -o test_models.py https://huggingface.co/spaces/Vinoth-46/YT-Automation/resolve/main/scratch/test_models.py
815 Bytes
| import asyncio | |
| import aiohttp | |
| import os | |
| async def test(): | |
| headers = { | |
| 'Authorization': f"Bearer {os.getenv('OPENROUTER_API_KEY')}", | |
| 'Content-Type': 'application/json' | |
| } | |
| models = [ | |
| 'meta-llama/llama-3-8b-instruct:free', | |
| 'google/gemma-2-9b-it:free', | |
| 'mistralai/mistral-7b-instruct:free', | |
| 'qwen/qwen-2-7b-instruct:free' | |
| ] | |
| async with aiohttp.ClientSession() as s: | |
| for m in models: | |
| payload = {'model': m, 'messages': [{'role':'user','content':'hi'}]} | |
| async with s.post('https://openrouter.ai/api/v1/chat/completions', headers=headers, json=payload) as r: | |
| print(f"Model: {m}, Status: {r.status}") | |
| if r.status != 200: | |
| print(await r.text()) | |
| asyncio.run(test()) | |