Host safer conversations with Perspective API

Google for Developers · Beginner ·🛠️ AI Tools & Apps ·5y ago

Key Takeaways

Perspective API is a free API that helps host better conversations online by limiting toxic discourse

Full Transcript

hey there i'm ben morse i'm a developer advocate at google where i work to make the web better for users and developers alike people should be able to engage in authentic discussions on the web without fear that's why the web was created toxic comments and harassment shouldn't silence people's voices and yet unfortunately this can be a problem that's why i was so excited to discover perspective perspective is a free api that helps you host better conversations online by limiting toxic discourse i think it's good for the web and i want to help you get started with it so first we'll talk about what perspective api is and then i'll show you how to set it up so what is perspective api perspective was created by the conversation ai initiative which is a collaboration between jigsaw and the counter abuse technology team at google conversation ai uses machine learning to fight online toxicity and harassment perspective uses machine learning models to analyze online comments guess the impact they might have in a conversation and assign each's score it can help you keep conversations civil on your site so you feel safe to share your voice with the world the api works with languages like english spanish french german portuguese and italian perspective scores comment on a set of attributes these attributes determine whether a comment might be toxic threatening insulting or simply off topic toxicity is the most popular attribute the site defines it as a rude disrespectful or unreasonable comment that is likely to make you leave the discussion here's an example someone reads an article on your site and makes the comment shut up you're an idiot before your site publishes this comment it gets fed through the perspective api perspective runs it through its models and scores it on attributes like toxicity insults and profanity returning some pretty high scores toxicity is 0.99 insult is 1.0 the maximum this is a comment you're likely to reject now you're probably wondering whether perspective is right for you here are some common use cases many sites use perspective to flag potentially harmful comments so a moderator can check them before they get posted for example perspective power is the tool used by moderators at the new york times coral by vox media uses perspective in the same way to curb online harassment in their comment sections and perspective is also available in plugins for discourse and for wordpress you can also make your own discord bot like dale markowitz did in this video beyond moderation you can also help commenters in real time by warning them that a comment might violate your community guidelines or could be perceived as toxic here when i type you're dumb the site warns me that this might well be toxic and recommends that i edit the comments when i change it to you're nice it's non-toxic finally you can let readers filter comment sections to hide potentially harmful comments perspective powers a chrome extension called tune which helps people see fewer toxic comments across the web these are the most common use cases but people use the ipi in all kinds of creative ways for example audiobond uses speech-to-text to transcribe audio and check the transcription for toxic content while perspective is pretty smart you're not going to want to use it for fully automated moderation any machine learning models can make mistakes that a human wouldn't instead it's better to use perspective to flag comments for a human to review think of it as a time saver for more information about how to use or not use perspective check out the best practices and risks on the site now let's get started i'll walk you through the steps you'll need to get perspective api up and running perspective runs on google cloud to use it you'll need a google account and you'll need to set up a cloud project google cloud is a set of cloud computing services that runs on google's infrastructure it's a good place to host a reliable api to get started make sure you've logged in with or created a google account then go to the cloud console page at console.cloud.google.com to use a google cloud service you need to enable it within a google cloud project you can choose or create a project with a drop down on top of the page right near the words google cloud platform if you've already got a project this drop down will display the project's name if you haven't the drop down will say select a project in either case click this drop down you'll then see a pop-up showing your existing projects if you have any plus a button that says new project if you want to use an existing project do that or to create a new project click new project in the pop-up give the project whatever name you like make note of the project id that appears under the name as you'll need this to identify your project later on now click the create button and there it is our brand new google cloud project click view and we're in our project now that we have our project set up in google cloud we need to request access to the api we'll do this on the prospective api site so let's fill out the form and then we wait within an hour they're probably a lot less you should get a confirmation email look here's my confirmation now now we can enable the api there's two ways to do this way number one click on the link in the email that'll lead you back to the api's page in the google developers site visit the prospective api overview page click enable choose your project and you're done way number two if you like using the command line and you've already installed the google cloud sdk type gcloud services enable commentanalyzer.googleapis.com finally we need to generate an api key to authenticate our requests this key is our own private code unique to us a secret token for our cloud api if you're already on the credentials page as we are click api key on the next page choose a name for your api key for security it's best to set some application restrictions in the interface click create and you're done you can also go to the google api credentials page and click create credentials then click choose api key in the credentials drop down of course you make requests from client-side javascript on your website people will be able to discover your api key so it's best to store your api key safely on your server and proxy requests through your own web service your api key should begin working in a few minutes although it could take up to an hour once it's ready you can copy your api key and get to work to learn how to use the api itself go to the prospective developer sites if you want to get started quickly the methods page describes how to use the two methods analyze comment and suggest comments score by default the api has a quota limit of about 60 queries for 60 seconds this is plenty for testing for small publishers like me i'm looking at lego 60 comments in a year if you need more quota request it on the developer's site when you do your first tests just send one comment to be on the safe side as you use the api don't batch up comments the big groups may hit your quota limits it may even be safe to send each comment with a small delay like this that's it if you missed anything go to that developer's site where you'll find the get started instructions sample use cases how you can contribute feedback to help improve the machine learning models if you're concerned about data and privacy check out the site to see how your data is kept secure thanks for listening we're excited to see how you use perspective you

Original Description

Perspective is a free API that helps you host better conversations online. The API uses machine learning models to score the perceived impact a comment might have on a conversation. You can use this score to implement tools that give feedback to commenters, help moderators more easily review comments, allow readers to more easily find interesting or productive comments, and more. In this tutorial, we’ll show you how to get started! Timestamps: 0:00 Introduction 00:48 What is Perspective? 02:15 How can I use it? 04:02 Getting Started 04:33 Create a Google Cloud Project 05:30 Request API Access 05:53 Enable the API 06:24 Generate API Key 07:22 Resources Learn more on the Perspective Developers site at → https://goo.gle/3m10iG8 Additional resources: Best Practices and Risks → https://goo.gle/2GIBMtn Methods → https://goo.gle/334IvoM Request API Access → https://goo.gle/3jTQpbp I built a moderation bot for Discord → https://goo.gle/35ex28Q Subscribe to Google Developers → https://goo.gle/developers
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Google for Developers · Google for Developers · 0 of 60

← Previous Next →
1 Developer Journey - Sunnyvale DSC Summit ‘19
Developer Journey - Sunnyvale DSC Summit ‘19
Google for Developers
2 How Google is working with students - Sunnyvale DSC Summit ‘19
How Google is working with students - Sunnyvale DSC Summit ‘19
Google for Developers
3 Starting your career in the Cloud - Sunnyvale DSC Summit ‘19
Starting your career in the Cloud - Sunnyvale DSC Summit ‘19
Google for Developers
4 The Solution Challenge  - Sunnyvale DSC Summit ‘19
The Solution Challenge - Sunnyvale DSC Summit ‘19
Google for Developers
5 Firebase - Sunnyvale DSC Summit ‘19
Firebase - Sunnyvale DSC Summit ‘19
Google for Developers
6 Cloud Hero - Sunnyvale DSC Summit ‘19
Cloud Hero - Sunnyvale DSC Summit ‘19
Google for Developers
7 Panel discussion  - Sunnyvale DSC Summit ‘19
Panel discussion - Sunnyvale DSC Summit ‘19
Google for Developers
8 The art of negotiation - Sunnyvale DSC Summit ‘19
The art of negotiation - Sunnyvale DSC Summit ‘19
Google for Developers
9 Courage to care, solve and share - Sunnyvale DSC Summit ‘19
Courage to care, solve and share - Sunnyvale DSC Summit ‘19
Google for Developers
10 Version 9 of Angular, Glass Enterprise Edition 2, path to DX deprecation, & more!
Version 9 of Angular, Glass Enterprise Edition 2, path to DX deprecation, & more!
Google for Developers
11 [DEPRECATING] Introducing a new series (Assistant for Developers Pro Tips)
[DEPRECATING] Introducing a new series (Assistant for Developers Pro Tips)
Google for Developers
12 Detecting memory bugs with HWASan, Bazel 2.1, Next ‘20 session guide, & more!
Detecting memory bugs with HWASan, Bazel 2.1, Next ‘20 session guide, & more!
Google for Developers
13 Why Podcast.app chose a .app domain name
Why Podcast.app chose a .app domain name
Google for Developers
14 Machine Learning Bootcamp Jakarta 2019
Machine Learning Bootcamp Jakarta 2019
Google for Developers
15 Android Studio 3.6, Android 11 Developer Preview, Kubeflow 1.0, & more!
Android Studio 3.6, Android 11 Developer Preview, Kubeflow 1.0, & more!
Google for Developers
16 [DEPRECATING]  Importance of community (Assistant on Air)
[DEPRECATING] Importance of community (Assistant on Air)
Google for Developers
17 Why the Flutter team switched from .io to a .dev domain name
Why the Flutter team switched from .io to a .dev domain name
Google for Developers
18 3 website-building tips from .dev creators
3 website-building tips from .dev creators
Google for Developers
19 Why NimbleDroid chose a .app domain name
Why NimbleDroid chose a .app domain name
Google for Developers
20 Android Platform Codelab, Bazel 2.2, Maps Android Utility Library v1.0, & more!
Android Platform Codelab, Bazel 2.2, Maps Android Utility Library v1.0, & more!
Google for Developers
21 Google for Games Developer Summit: A free, digital experience for game developers
Google for Games Developer Summit: A free, digital experience for game developers
Google for Developers
22 Inspecting Home Graph (Assistant for Developers Pro Tips)
Inspecting Home Graph (Assistant for Developers Pro Tips)
Google for Developers
23 Google for Games Developer Summit Keynote
Google for Games Developer Summit Keynote
Google for Developers
24 Stadia Games & Entertainment presents: Keys to a great game pitch (Google Games Dev Summit)
Stadia Games & Entertainment presents: Keys to a great game pitch (Google Games Dev Summit)
Google for Developers
25 Empowering game developers with Stadia R&D (Google Games Dev Summit)
Empowering game developers with Stadia R&D (Google Games Dev Summit)
Google for Developers
26 Supercharging discoverability with Stadia (Google Games Dev Summit)
Supercharging discoverability with Stadia (Google Games Dev Summit)
Google for Developers
27 Stadia Games & Entertainment presents: Creating for content creators (Google Games Dev Summit)
Stadia Games & Entertainment presents: Creating for content creators (Google Games Dev Summit)
Google for Developers
28 Bringing Destiny to Stadia: A postmortem (Google Games Dev Summit)
Bringing Destiny to Stadia: A postmortem (Google Games Dev Summit)
Google for Developers
29 Live Captioning in Google Slides
Live Captioning in Google Slides
Google for Developers
30 [DEPRECATING]  User engagement for the Google Assistant
[DEPRECATING] User engagement for the Google Assistant
Google for Developers
31 TensorFlow Dev Summit ‘20, Google for Games Dev Summit, Cloud AI Platform Pipelines, & much more!
TensorFlow Dev Summit ‘20, Google for Games Dev Summit, Cloud AI Platform Pipelines, & much more!
Google for Developers
32 Top 5 from the TensorFlow Dev Summit 2020
Top 5 from the TensorFlow Dev Summit 2020
Google for Developers
33 Developer Student Clubs 2019 Turkey Leads Summit
Developer Student Clubs 2019 Turkey Leads Summit
Google for Developers
34 Building simpler payment experiences | Google Pay Plugin for Magento 2
Building simpler payment experiences | Google Pay Plugin for Magento 2
Google for Developers
35 Become A Developer Student Club Lead
Become A Developer Student Club Lead
Google for Developers
36 Firebase Kotlin Extensions, ARM apps on the Android Emulator, Angular v9.1, & more!
Firebase Kotlin Extensions, ARM apps on the Android Emulator, Angular v9.1, & more!
Google for Developers
37 Test suite for Smart Home (Assistant for Developers Pro Tips)
Test suite for Smart Home (Assistant for Developers Pro Tips)
Google for Developers
38 Google Play updates, Bazel 3.0, Business Console for Google Pay, & more!
Google Play updates, Bazel 3.0, Business Console for Google Pay, & more!
Google for Developers
39 How to use error logs (Assistant for Developers Pro Tips)
How to use error logs (Assistant for Developers Pro Tips)
Google for Developers
40 Contact Center AI, Android Studio 4.1 Canary 5, TensorFlow QAT API, & more!
Contact Center AI, Android Studio 4.1 Canary 5, TensorFlow QAT API, & more!
Google for Developers
41 WebView DevTools, Kotlin meets gRPC, Flutter CodePen support, & more! (Episode 200)
WebView DevTools, Kotlin meets gRPC, Flutter CodePen support, & more! (Episode 200)
Google for Developers
42 Offline handling for Smart Home (Assistant for Developers Pro Tips)
Offline handling for Smart Home (Assistant for Developers Pro Tips)
Google for Developers
43 Android 11 Dev Preview 3, Google Fonts for Flutter, Shielded VM, & more!
Android 11 Dev Preview 3, Google Fonts for Flutter, Shielded VM, & more!
Google for Developers
44 Machine Learning Foundations: Ep #1 - What is ML?
Machine Learning Foundations: Ep #1 - What is ML?
Google for Developers
45 Flutter web support updates, BigQuery materialized views, Cloud Spanner emulator, & more!
Flutter web support updates, BigQuery materialized views, Cloud Spanner emulator, & more!
Google for Developers
46 Computer vision by building a neural network with TensorFlow | Machine Learning Foundations
Computer vision by building a neural network with TensorFlow | Machine Learning Foundations
Google for Developers
47 Machine Learning Foundations: Ep #3 - Convolutions and pooling
Machine Learning Foundations: Ep #3 - Convolutions and pooling
Google for Developers
48 Android 11 Beta plans, Flutter 1.17, Dart 2.8, & much more!
Android 11 Beta plans, Flutter 1.17, Dart 2.8, & much more!
Google for Developers
49 Machine Learning Foundations: Ep #4 - Coding with Convolutional Neural Networks
Machine Learning Foundations: Ep #4 - Coding with Convolutional Neural Networks
Google for Developers
50 Google Developers ML Summit
Google Developers ML Summit
Google for Developers
51 Real-world image classification using convolutional neural networks | Machine Learning Foundations
Real-world image classification using convolutional neural networks | Machine Learning Foundations
Google for Developers
52 Adobe XD support for Flutter, Architecture Framework, temporary closures with Places API, & more!
Adobe XD support for Flutter, Architecture Framework, temporary closures with Places API, & more!
Google for Developers
53 Machine Learning Foundations: Ep #6 - Convolutional cats and dogs
Machine Learning Foundations: Ep #6 - Convolutional cats and dogs
Google for Developers
54 Machine Learning Foundations: Ep #7 - Image augmentation and overfitting
Machine Learning Foundations: Ep #7 - Image augmentation and overfitting
Google for Developers
55 Announcing Firebase Live, Flutter Day, Java 11 on Google Cloud Functions, & more!
Announcing Firebase Live, Flutter Day, Java 11 on Google Cloud Functions, & more!
Google for Developers
56 Machine Learning Foundations: Ep #8 - Tokenization for Natural Language Processing
Machine Learning Foundations: Ep #8 - Tokenization for Natural Language Processing
Google for Developers
57 Android 11 Beta, Google Play Asset Delivery, Firebase Crashlytics SDK, & much more!
Android 11 Beta, Google Play Asset Delivery, Firebase Crashlytics SDK, & much more!
Google for Developers
58 Natural Language Processing: Using sequencing APIs in TensorFlow | Machine Learning Foundations
Natural Language Processing: Using sequencing APIs in TensorFlow | Machine Learning Foundations
Google for Developers
59 Build a sarcasm classifier using NLP and TensorFlow | Machine Learning Foundations
Build a sarcasm classifier using NLP and TensorFlow | Machine Learning Foundations
Google for Developers
60 AR Realism with the ARCore Depth API
AR Realism with the ARCore Depth API
Google for Developers

Related Reads

📰
I Did the Math on Claude Opus 5: Max Effort Cost 94% More Than High Effort
Understand how effort levels impact costs in Claude Opus 5, a crucial factor for budgeting and resource allocation
Dev.to · tokenmixai
📰
I Banned AI Tools From My Creative Process for 30 Days. Here’s What Happened to My Brain
A creator banned AI tools from their process for 30 days and observed significant changes in their thinking and creativity, highlighting the impact of AI on human cognition
Medium · AI
📰
Best AI Tools for Content Creators With Zero Budget
Discover the best free AI tools for content creators with no budget, and learn how to leverage them for high-quality content
Medium · AI
📰
Stop Building AI Chatbots. Build These 7 AI Products Instead.
Diversify your AI portfolio by building products that solve real-world problems beyond chatbots, attracting clients and generating revenue
Medium · Machine Learning

Chapters (9)

Introduction
0:48 What is Perspective?
2:15 How can I use it?
4:02 Getting Started
4:33 Create a Google Cloud Project
5:30 Request API Access
5:53 Enable the API
6:24 Generate API Key
7:22 Resources
Up next
Forget ChatGPT, This AI Actually Runs My Small Business | Claude Co-Work Review
MailerLite
Watch →