File size: 647 Bytes
beb6a05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from __future__ import annotations

from model import Add2ModelError, TinyAdd2LLM


def main() -> None:
    model = TinyAdd2LLM.load("model/add2_model.bin")
    print("Tiny Add2 LLM loaded.")
    print(f"Limit: 0 to {model.max_number}. Type 'exit' to stop.")
    print("Examples: 12 + 30 | add 15 and 7 | 100 plus 55")

    while True:
        user = input("You: ").strip()
        if user.lower() in {"exit", "quit", "q"}:
            print("Bye")
            break
        try:
            print("TinyAdd2LLM:", model.answer(user))
        except Add2ModelError as e:
            print("TinyAdd2LLM:", e)


if __name__ == "__main__":
    main()