Streamlit cloud TypeError: expected str, bytes or os.PathLike object, not UploadedFile

Hello,

My app was working fine and all of a sudden it just started throwing this error, I didn’t change anything and have gone through most of the answers shared on this but none really worked.

’ ```
Traceback (most recent call last):


File “/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 565, in _run_script


exec(code, module.__dict__)

File “/app/tomato-plant-detection/app.py”, line 111, in


preds = leaf_predict(uploaded_file, model1)

File “/app/tomato-plant-detection/app.py”, line 84, in leaf_predict


img = image.load_img(uploaded_file, target_size=(256, 256))

File “/home/appuser/venv/lib/python3.9/site-packages/keras/preprocessing/image.py”, line 313, in load_img


return image.load_img(path, grayscale=grayscale, color_mode=color_mode,

File “/home/appuser/venv/lib/python3.9/site-packages/keras_preprocessing/image/utils.py”, line 113, in load_img


with open(path, 'rb') as f:

TypeError: expected str, bytes or os.PathLike object, not UploadedFile


2023-02-24 13:13:33.019 label got an empty value. This is discouraged for accessibility reasons and may be disallowed in the future by raising an exception. Please provide a non-empty label and hide it with label_visibility if needed.


Here's the link to the application https://jamessandy-tomato-plant-detection-app-8e49bd.streamlit.app/

Please provide a link to your public github repo.
Please learn how to properly post code snippets or error messages here in the forum with markdown:

```log
# put your error messages here
```
```python
# put your python code here
```

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.