If you know you are depressed, how can you talk yourself out of it?

Probably Need Help. There are self-help books for sale to try to help yourself overcome depression. However, you are far more likely to be successful by going to see a counselor or therapist to help give you a framework and setting for this type of effort. If needed, you may also want to consider the need for medication treartment.
Allow help. Trying to talk yourself out of depression is like trying to give yourself a haircut -- it doesn't work (or you miss significant parts). Much better to allow the assistance of someone skilled in working with this kind of problem -- like a psychiatrist or other kind of psychotherapist. They will keep what you share confidential, and with help you can work your way out of this. Good luck.