FileNotFoundError: [Errno 2] No such file or directory: 'images/icon.png'

Hi, this is my first time using streamlit, now when I tested the code on my local machine everything worked perfectly however when i try to deploy it it print out this Error



Also I’ve searched for other cases but I used forward slashes ofcourse so it doesn’t make sense

img = Image.open("images/icon.png")
AntiRumour = Image.open('images/machine-learning.jpg')
st.image(AntiRumour)

Also I tried moving the images to the same folder again it didn’t work but it works on my local machine,

My github repo: Deep_Learning/Project_final/UI at main · ayman-codes/Deep_Learning · GitHub

Can you try ./images/icon.png instead to see if that helps?

Hi, thank you for replying, unfortunately it didn’t work :frowning:

I found the solution, First I was trying to open the image as if it was on my local machine, instead you can just get the image from the url. so navigate to your github where you’ve uploaded your image, then open it and right click on the image>open in a new tab, then you can copy the link and replace it with URL
url_icon = “URL”
response = requests.get(url_icon)
img = Image.open(BytesIO(response.content))
Hope this helps :slight_smile: