Do you lose the respective trading cards when uninstalling a steam game?

Solution 1:

No, trading cards are items stored in your inventory

If you uninstall a game, the cards you've already collected will remain in your inventory.

Additionally, any progress you've made towards collecting cards and the total you've earned out of the available gifted free cards from playing will be preserved. For example, if you have collected 3 out of 4 available "free" cards that can be earned by playing a game when you uninstalled it, reinstalling the game in the future will allow you to collect the one remaining "free" card.

Solution 2:

No, if you uninstall a game, or Steam, you will not lose your cards. This information is stored in the cloud.