Accessing URL from Chrome and Safari goes well but terminal encounters `curl: (52) Empty reply from server`, what do I do?
The content you get from a server doesn't just depend on the URL. It can depend on the request method, the language preferences, user agent, cookies, etc.
You can ask your browser exactly what it sends to the server. Chrome, Firefox and Safari all have a command in their developer tools which copies something to the clipboard that you can paste in a shell window. In Safari, enable developer tools and open the Web Inspector on the current page. In Chrome or Firefox, press F12. In any of these browsers, in the developer tools, go to the Network tab, reload the page, select the first location and “Copy as cURL” from the context menu (it may be in a “Copy” submenu). Then paste the command in a terminal. The command will have the form
curl -X GET -H … http://192.168.31.37:5000/aa

Your curl command doesn't specify a method, so it's a GET by default. The form specifies a POST. So if you're trying to simulate entering the form, you'll need to pass -X POST to curl, and of course to pass the form data. To see what the browser sends with the form, open the developer tools' and switch to the ”Network“ tab before submitting the form, then use the “copy as cURL” command from the form URL.