i am a web developer (php, js, css and ...). i order a python script for remove image background. it worked in cmd very well but when running it from php script, it dosnt work. i look at the script for find problem and i realized that the script stops at this line:
net.load_state_dict(self.torch.load(os.path.join("../library/removeBG/models/", name, name + '.pth'), map_location="cpu"))
I guess the problem with the script is that it can't find the file, and probably the problem is caused by the path that os.path points to. Is it possible to print the path that os .path points to? If not, do you have a solution to this problem?
This should be enough:
name = 'name'
p = os.path.join("../library/removeBG/models/", name, name + '.pth')
print(p)
This is what i get:
>>> ../library/removeBG/models/name/name.pth