For CPU temps and and at least for open source AMD GPU drivers you should be
able to use libsensors from lmsensors, for proprietary NVIDIA and and AMD drivers
you need to use the interfaces they provide, if they even do.

I wouldn't use proc directly in this case as the sensor information provided there depends on the actual hardware. Like @Huulivoide suggested using lmsensors is much nicer as it provides a high level interface.

Edit: Ok, of course the sensor information depends on the actual hardware. What I wanted to say is that the way the info is presented there depends on the hardware (the drivers). E.g. different file paths and names.