Number guessing game in Python3 Is there any room for improvement?

import random

def play_again():
    while True:
        replay = input('Play again? Yes or No?\n')
        if replay.lower() == 'yes':
            return True
        elif replay.lower() == 'no':
            return False
        print('Invalid input.')

def main():
    print('Welcome to the number guess game!', end='\n\n')

    random_number = random.choice(range(1, 51)) #Genarate a number between 1 and 50 inclusive

    print("I'm thinking of a number which is between 1 and 50 (inclusive). Can you guess it?")

    guesses, guess = 0, 0

    while guess != random_number:
        try:
            guess = int(input("Enter a number: "))
        except:
            print('Invalid input.')
            continue
        if guess &gt; random_number:
            print('Too high. Guess lower.')
        elif guess &lt; random_number:
            print('Too low. Guess higher.')
        guesses+=1
    print('Congratz. You guessed my number {0} in {1} guesses'.format(random_number, guesses))

    if play_again():
        main()
    else:
        print('Bye!')

main()
main()
You should use if __name__ == &quot;__main__&quot;:, like this:
if __name__ == &quot;__main__&quot;: 
    main()

This will prevent your code from automatically running if you ever import this module into another module.
Methods
I like how you split play_again() into a separate method.  However, you should use more methods, including a unique method to play the game, and perhaps a method to input a guess from the user.
Recursion
Recursion here is not good.  If the user plays the game enough times, you could have a stack overflow exception:
if play_again():
    main()
else:
    print('Bye!')

If you split the game up into multiple methods that you can call, each method could finish and get removed from the stack before it returns control to the caller, so you never have a stack overflow.
An example of this would be to have something like this:
def play_again():
    # code here

def game():
    # play game here

def main():
    print('Welcome to the number guess game!', end='\n\n')

    play_game = True
    while play_game:
        game()
        play_game = play_again()

if __name__ == &quot;__main__&quot;:
    main()