File size: 537 Bytes
ff7ae85 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | """Load Connais 1 from this folder and answer one request.
pip install .
python example.py
"""
import json
from pathlib import Path
from connais import load_engine
here = Path(__file__).parent
engine = load_engine(here) # or load_engine("Connais/connais-1-68m") to fetch the files from the Hub
request = json.loads((here / "examples" / "request.json").read_text())
response, timing = engine(request["state"], request["questions"])
print(json.dumps(response, indent=2))
print(f"{timing['wall_ms']:.1f} ms on {engine.device}")
|