You wont "get away" with it. Even if it was a hemp or ditchweed plants, bladed leaves = mj charge regardless of quality. I'd be skipping town right about now, or hiring an attorney while I still can before being put behind bars and having to phone random ones. Since you said your friend gave you seeds and you thought they were tomato plants, you've just admitted they're yours and that you were growing them. Hope you didnt give your friends name up. Jury is never going to believe you were growing tomatos in some ghetto closet setup that was hidden either.
Clean your apartment, car up from all illegal items that they have not found yet and especially scales, baggy's, any other contraband and your computer if you have something they shouldnt see on it. Like a gallery on rollitup or something. They will tear your place apart when they come back after those plants test positive. With some luck your attorney can hopefully get it tossed out for illegal entry / search, or plea guilty to personal use. Good luck.