Fit the model to the hosting budget
Qafiya pairs PyArud’s classical prosody analysis with a bundled approximately 4.8 MB libtashkeel ONNX model. Vocalization runs locally on the CPU without PyTorch, Transformers, a GPU, or an external model server. A single Uvicorn worker shares a bounded, serialized inference session, keeping model copies and simultaneous inference under control.
Preserve the author’s text
Existing vowel marks remain authoritative. Automatic vocalization fills missing marks and discloses changes; the interface shows the analyzed text while retaining the original input. The distinction matters because scansion depends on pronunciation, and a predicted vowel can change the result.
Test the container, then state the limits
The documented local whole-ASGI workload ran the production image under a 512 MiB RAM and 0.1 CPU cap, peaking at 142.55 MiB process RSS without an out-of-memory failure. This is evidence for a bounded workload, not a guarantee under arbitrary public traffic. In a separate 12-verse vocalization sample, partial-source meter matches improved from 2/12 to 10/12; fully unvocalized input reached only 2/12.
Keep repair bounded and sound text intact
The experimental drafting flow checks meter and the requested rawi, then revises failed verses with a bounded loop. The backend preserves accepted verses and sound hemistichs. Rawi equality is narrower than full classical rhyme validation, and machine acceptance does not certify literary quality. AI generation remains disabled in the public demo.