My personal opinion is that you should just guess based on context. It may become clearer later in the story, or it might not. In this particular case, it’s not clear because no gendered language has been used yet. The use of の at the end of a sentence may indicate that the speaker is female, but that’s not clear because here, の is being used to end a question, and that usage is (as far as I know) common among both men and women. The use of の to end a statement, however, is stereotypically feminine.
In essence, in Japanese, especially in literature, you work out gender based on gendered language. You’ll probably learn more about this over time, but the essence of it is that masculine language tends to sound more assertive and even rough, whereas feminine language tends to seek consensus and is smoother or more gentle. These differences are often highlighted by certain particles or ways of using verbs. The other way to know what gender someone is (or what’s being implied about their gender/personality) is when gender-specific pronouns, particularly first-person pronouns, are used, like あたし (cutesy female ‘I’), 俺 (casual/rough male ‘I’) and ぼく (casual but somewhat more polite/gentle male ‘I’). You’ll see these much more often in light novels, and possibly other books. Note also that gendered language tends to be a little exaggerated in literature as compared to usage in real life, possibly because authors want to make it clear who’s speaking among a bunch of characters.
Ultimately though, just remember that Japanese, even if it stems from a culture in which gender roles are probably still quite traditional in many cases, can also be extremely ‘gender-unspecific’. さん and さま are both completely genderless, for instance, and even くん can be used for both genders, even if it’s more commonly used for young men or boys. Gender in Japanese is more often implied by context and language use than stated, and that’s just something we have to accept.
In short, it may seem like ‘guessing’ now, but usually, once the language you encounter becomes more complex, you’ll start to realise that you don’t have to guess: the speaker’s gender is often encoded in the way they speak.