The straight part will not contribute magnetic field at the centre of the semicircle because every element of the straight part will be $0^{\circ}$ or $180^{\circ}$ with the line joining the centre and the element
Due to circular portion, the field is
$\frac{1}{2} \frac{\mu_{0} i}{2 r}=\frac{\mu_{0} i}{4 r}$
Hence total field at $\mathrm{O}=\frac{\mu_{0} \mathrm{i}}{4 \mathrm{r}}$ $tesla$