Most people who sit down to play piano in public have 2 main objectives:
1. Don't make a fool of themselves.
2. Impress their listeners.
The irony with this is that #2 usually leads to #1. The more we try to impress our listeners, the worse we usually play. This is as true at Carnegie Hall as it is in a friend's living room.
The solution, which you can try the next time you play piano for someone, is to choose a piece of music which you know so well that you can truly enjoy playing it. Or, if you're improvising, to focus on each note without trying to do anything fancier that you're capable of playing well.
The more you immerse yourself in the music, the less you'll think about impressing anyone and the better you'll probably end up playing after all.
Give it a try and have fun!