Answer
$$a=2 ,\ \ b= 1$$
Work Step by Step
Given $$
f(x)=\left\{\begin{array}{ll}
{x^{-1}} & {\text { for } x\frac{1}{2}}
\end{array}\right.
$$
Since $f(-1)= b-a$
\begin{align*}
\lim_{x\to -1^+}f(x) &= \lim_{x\to -1^+}x^{-1}\\
&=-1\\
\lim_{x\to -1^-}f(x) &= \lim_{x\to -1^-}(ax+b)\\
&=b-a
\end{align*}
Then $f(x)$ is continuous at $x= -1$ when
$$ b-a=-1\tag{1}$$
Since $f(1/2)= \dfrac{1}{2}a+b$
\begin{align*}
\lim_{x\to (1/2)^+}f(x) &= \lim_{x\to (1/2)^+}x^{-1}\\
&=2\\
\lim_{x\to (1/2)^-}f(x) &= \lim_{x\to (1/2)^-}(ax+b)\\
&= \dfrac{1}{2}a+b
\end{align*}
Then $f(x)$ is continuous at $x= 1/2$ when
$$ \dfrac{1}{2}a+b=2\tag {2}$$
By solving (1) and (2), we get
$$a=2 ,\ \ b= 1$$