Instagram has announced two new tools that use artificial intelligence (AI) to block offensive and spam comments on posts to the photo sharing app.

The Facebook-owned platform said the AI filters have been "trained" to identify and block comments from appearing underneath posts if they are recognised as either offensive or spam-related.

A button is being added to the app's settings under the Comments section, enabling users to turn on the comment blocker.

"Powered by machine learning, today's filters are our latest tools to keep Instagram a safe place," Instagram chief executive Kevin Systrom wrote in a blog post.

"Our team has been training our systems for some time to recognise certain types of offensive and spammy comments so you never have to see them.

"The tools will improve over time, enabling the community's experience of sharing to improve as well. We hope to make these filters available in more languages as our algorithms improve."

Social media giants Facebook and Twitter have been among those criticised in recent months over their response to hateful and extreme content on their platforms, something both have pledged to improve.

"We believe that using machine learning to build tools to safeguard self-expression is an important step in fostering more inclusive, kinder communities," Mr Systrom said.

"Our work is far from finished and perfect, but I hope we're helping you feel safer and more welcome on Instagram."