This is as simple as I can get it. I'll assume we're talking about complex functions; if real, tensor with $\mathbb{C}$. Now pass to the units. With the topology given by spectral radius (this is an algebraic description of the C-* topology), the group of connected components of the group of units is $H^1(X, \mathbb{Z})$ which of course knows the genus.