Both methods have a failure option. You go off meds & return to your old eating habits, the weight comes back. With the surgery, you go back to how you used to eat, you regain the weight.
Both require you to do the work to change your relationship with food, make better food choices, become more active, learn to recognize real hunger from head hunger & learn about what drives you to eat & develop strategies to manage those drives like your food obsession voices. Neither routes are true easy permanent solutions without doing this work. The class you attended seems like it got you started on this & on the right path.
The win of the surgery for me was time. The period of time when I wasn’t hungry or interested in eating, the change to my taste buds, etc. allowed me to start doing that work. I learnt what my body needed, how to keep my boosted metabolism going & to keep my new weight set point stable.
Certainly worth conversations with your doctor & a bariatric surgeon to see what they think is the best way forward for you. Also ask for a referral to a therapist who specialises in disordered eating to support you through doing the head work. Many who’ve had surgery find therapy very helpful & contributed to their success & it would likely be helpful even if you choose not to have surgery.
All the best what ever you choose to do.
PS - I second the Dr Matt Weiner’s Pound of Cure you tube videos. He’s also on instagram & has some great books. Dr John Pilcher also has some great you tube videos on weight loss & surgery. Another consideration is I understand the newest weight loss med is supposed to less expensive & is expected to help push down the cost of the existing ones.