You're likely facing a runtime environment issue. The first execution triggers model downloads and widget rendering. If you're using Jupyter/Colab, the frontend may not be fully ready, causing display errors. Once cached, the second run works smoothly.
This might help:
Isolate model loading in a separate cell or script.
Add simple print logs to track download/init time.
Run in a standard Python script (e.g., VS Code terminal) to avoid frontend rendering issues.
This is a classic case of execution environment quirks,, similar to what you'd encounter when debugging backend issues in server-side apps. If you're into that sort of thing, this quick read offers a good debugging mindset.