Streamlit with pyautogui

I am running my pyautogui script successfully from my computer (local host)
But when my app get accessed from other computer in my local area network
I got this error
OSError: screen grab failed

It looks like that it can not find the Capture.PNG located on my server
What is wrong with my script?

Here is my script

def clickit():
    clicked = pyautogui.locateCenterOnScreen('Capture.PNG')
    pyautogui.click(clicked)

I’m not entirely sure so don’t pin me down on this:
But I think the server has no graphics context to make a screen grab off. I’m also unsure how to fix it but you could try running some tests with a headless browser to see if those can grab a screenshot?

Just to make sure: double-check if the Capture.PNG file is actually there with that name and the script can access it(maybe file permissions?).