What kind of music are you playing? I play mostly Irish but I’m no expert on the process nor am I very good at explaining.
However, if you are playing Irish or folk music and you know what key apiece is in and you know what the chord changes are you can improvise with your bass hand around that.
For a lot of my tunes I just write what each chord is while I’m learning it and to start I just do octaves or fifths of the chord.
For the melody (right hand) I find that if I can hum the tune to myself I should be able to play it without the music. (Once I’ve worked out any tricky bits.)