This paper considers a mobile edge computing (MEC) system, where the MEC server first collects data from emotion sensors and then computes the emotion of each user. We give the formula of the emotional prediction accuracy. In order to improve the energy efficiency of the system, we propose resources allocation algorithms. We aim to minimize the total energy consumption of the MEC server and sensors by jointly optimizing the computing resources allocation and the data transmitting time. The formulated problem is a non-convex problem, which is very difficult to solve in general. However, we transform it into convex problems and apply convex optimization techniques to address it. The optimal solution is given in closed form. Simulation results show that the total energy consumption of our system can be effectively reduced by the proposed scheme compared with the benchmark.