Build FastDeploy runtime options based on backend and device.
()
| 85 | return res_text |
| 86 | |
| 87 | def build_option(): |
| 88 | """Build FastDeploy runtime options based on backend and device.""" |
| 89 | det_option = fd.RuntimeOption() |
| 90 | cls_option = fd.RuntimeOption() |
| 91 | rec_option = fd.RuntimeOption() |
| 92 | |
| 93 | if BACKEND.lower() == "gpu": |
| 94 | det_option.use_gpu(DEVICE_ID) |
| 95 | cls_option.use_gpu(DEVICE_ID) |
| 96 | rec_option.use_gpu(DEVICE_ID) |
| 97 | else: |
| 98 | det_option.use_cpu() |
| 99 | cls_option.use_cpu() |
| 100 | rec_option.use_cpu() |
| 101 | |
| 102 | return det_option, cls_option, rec_option |
| 103 | |
| 104 | |
| 105 | # Build model file paths |