I have struggled with depression for many years.
What I have learned is that some antidepressants and medications can cause weight gain.
Try talking to your doctor about what you are going through and maybe he or she can make some recommendations. Also, your doctor can test your thyroid.
Give yourself a lot of credit by getting control of this now.
Good luck!