Download example.py from hugging-mac/vela3-fast-CoreAI: direct link, hf CLI and curl.
- Browser
- Download file 857 Bytes
-
https://huggingface.co/hugging-mac/vela3-fast-CoreAI/resolve/main/example.py
- Command line
-
hf download hf://hugging-mac/vela3-fast-CoreAI/example.py
-
curl -L -o example.py https://huggingface.co/hugging-mac/vela3-fast-CoreAI/resolve/main/example.py
857 Bytes
| import asyncio | |
| import json | |
| from pathlib import Path | |
| from vela_coreai import VelaCoreAI # type: ignore[import-not-found] | |
| async def main() -> None: | |
| async with VelaCoreAI.open(Path(__file__).parent) as model: | |
| result = await model.predict( | |
| "请写一个 Python 排序函数。", | |
| { | |
| "type": "choice", | |
| "instructions": "What is the topic?", | |
| "criteria": {"coding": "Software", "cooking": "Food"}, | |
| }, | |
| ) | |
| print(json.dumps(result, ensure_ascii=False, indent=2)) | |
| print( | |
| await model.predict( | |
| "Python code", | |
| { | |
| "type": "noul", | |
| "instructions": "Is this about software?", | |
| }, | |
| ) | |
| ) | |
| if __name__ == "__main__": | |
| asyncio.run(main()) | |