Download examples/quickstart.py from Cem13/kodama-core: direct link, hf CLI and curl.
- Browser
- Download file 1.2 kB
-
https://huggingface.co/Cem13/kodama-core/resolve/main/examples/quickstart.py
- Command line
-
hf download hf://Cem13/kodama-core/examples/quickstart.py
-
curl -L -o quickstart.py https://huggingface.co/Cem13/kodama-core/resolve/main/examples/quickstart.py
1.2 kB
| """Run from any directory after installing the downloaded model's runtime.""" | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| from jevlike import SystemOne, Choice, Score, Noul | |
| def main(): | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument('--model-dir', type=Path, default=Path(__file__).resolve().parents[1]) | |
| parser.add_argument('--device', default='cuda', choices=['cuda', 'cpu']) | |
| args = parser.parse_args() | |
| model = SystemOne.load(str(args.model_dir), device=args.device, long_state='chunk') | |
| questions = { | |
| 'team': Choice('Which team should handle this request?', { | |
| 'billing': 'payments, invoices, refunds', | |
| 'technical': 'bugs, errors, broken software', | |
| 'other': 'another kind of request', | |
| }), | |
| 'urgency': Score('How urgent is this request?', ['low', 'normal', 'urgent']), | |
| 'refund': Noul('The customer explicitly requests a refund.'), | |
| } | |
| state = json.dumps({'message': 'I was charged twice. Please refund the duplicate payment.'}) | |
| result = model.predict(state, questions) | |
| print(json.dumps(result, indent=2, allow_nan=False)) | |
| if __name__ == '__main__': | |
| main() | |