I definitely agree with ruling out the UTI. To add on to what McGloomy said - correct during the act, not after - I've gone as far as to push my puppy with two fingers (not hard, just enough to move him slightly) while saying, "Nuh-uh!" the one time he tried to pee in front of me on the carpet, then scooped him up and took him outside to finish with praise. He's had 2 accidents in the month I've had him - both times were my fault and one time was in front of me.
Patience! Block off the inside potty spot - maybe try a different cleaner to see if it makes a difference. We use Nature's Miracles (sp?) I have a carpet version and hardwood. Keep him leashed/crated/baby gated/ex-penned/etc with you. Mine just started going up the stairs without me to do his own thing (just like his mom *sighs*) so I have to be extra careful to keep an eye on him.
Edit to add: some puppies take longer to potty train than others. My shiba and Steel were/are relatively potty trained at less than 3 months old. Katsu. my female, took until 8 months to fully/reliably potty train.
+ Kalbi CGC 6/21/2015
+ Blackthorn's Out of the Frying Pan NW1 SCN BCAT SIN RATN TKN (Katsu) 9/12/2017
+ Blackthorn's Skofnung CGC TKN RATI RATO (Steel) 07/23/2018