Im trying to deploy a YOLOV5 model to streamlit, everything works fine when I run this Locally, however when deployed I get this error
ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).
Traceback:
File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py", line 557, in _run_script
exec(code, module.__dict__)
File "app.py", line 33, in <module>
model = torch.hub.load('ultralytics/yolov5', 'custom', path=run_model_path)
File "/home/appuser/venv/lib/python3.9/site-packages/torch/hub.py", line 339, in load
model = _load_local(repo_or_dir, model, *args, **kwargs)
File "/home/appuser/venv/lib/python3.9/site-packages/torch/hub.py", line 368, in _load_local
model = entry(*args, **kwargs)
File "/home/appuser/.cache/torch/hub/ultralytics_yolov5_master/hubconf.py", line 83, in custom
return _create(path, autoshape=autoshape, verbose=_verbose, device=device)
File "/home/appuser/.cache/torch/hub/ultralytics_yolov5_master/hubconf.py", line 33, in _create
from models.common import AutoShape, DetectMultiBackend
File "/home/appuser/.cache/torch/hub/ultralytics_yolov5_master/models/common.py", line 28, in <module>
from utils.dataloaders import exif_transpose, letterbox
File "/home/appuser/.cache/torch/hub/ultralytics_yolov5_master/utils/dataloaders.py", line 31, in <module>
from utils.augmentations import (Albumentations, augment_hsv, classify_albumentations, classify_transforms, copy_paste,
File "/home/appuser/.cache/torch/hub/ultralytics_yolov5_master/utils/augmentations.py", line 15, in <module>
from utils.general import LOGGER, check_version, colorstr, resample_segments, segment2box, xywhn2xyxy
File "/home/appuser/.cache/torch/hub/ultralytics_yolov5_master/utils/general.py", line 38, in <module>
from ultralytics.yolo.utils.checks import check_requirements
I run a check and can see that from my local run, it fetches this file from cache:
Using cache found in C:\Users\PC/.cache\torch\hub\ultralytics_yolov5_master
Was wondering how I could sort this - would appreciate any assistance.