We report the detection of GeV $gamma$-ray emission from supernova remnant HESS J1731-347 using 9 years of {it Fermi} Large Area Telescope data. We find a slightly extended GeV source in the direction of HESS J1731-347. The spectrum above 1 GeV can be fitted by a power-law with an index of $Gamma = 1.77pm0.14$, and the GeV spectrum connects smoothly with the TeV spectrum of HESS J1731-347. Either a hadronic-leptonic or a pure leptonic model can fit the multi-wavelength spectral energy distribution of the source. However, the hard GeV $gamma$-ray spectrum is more naturally produced in a leptonic (inverse Compton scattering) scenario, under the framework of diffusive shock acceleration. We also searched for the GeV $gamma$-ray emission from the nearby TeV source HESS J1729-345. No significant GeV $gamma$-ray emission is found, and upper limits are derived.