An open API service indexing awesome lists of open source software.

https://github.com/thrzl/perspective

a python library for interacting with google's perspective api
https://github.com/thrzl/perspective

perspective perspective-api python python3

Last synced: 8 months ago
JSON representation

a python library for interacting with google's perspective api

Awesome Lists containing this project

README

          

# 💖 perspective
a strongly typed wrapper for google's perspective api

## ðŸ“Ķ installation
```sh
pip install perspectiveapi
```

## ðŸŠī example
### async
```py
from perspective import Perspective, Attribute

p = Perspective(key="...")

async def main():
s = await p.score(
"your message here", attributes=(Attribute.FLIRTATION, Attribute.SEVERE_TOXICITY)
)
print(s.flirtation)
print(s.severe_toxicity)
```

### blocking
```py
from perspective.blocking import Perspective, Attribute

p = Perspective(key="...")

def main():
s = p.score(
"your message here", attributes=(Attribute.FLIRTATION, Attribute.SEVERE_TOXICITY)
)
print(s.flirtation)
print(s.severe_toxicity)
```