The code snippet you posted uses roboflow-python package which provides HTTP client making calls to the Roboflow platform.
If you intend to use the models inside your app, please use https://github.com/roboflow/inference package. Here you may find getting-started docs: https://inference.roboflow.com/quickstart/run_a_model/
Device can be specified by env flag: CUDA_VISIBLE_DEVICES