Summarize and Narrate your emails through power of LLMs.
Project description
INarrator
Install the Package
pip install inarrator
Use the Package
Gmail
-
In the Google Cloud console, enable the Gmail API.
-
Register your App
- In the Google Cloud console, go to OAuth Consent screen
- Once on OAuth Consent Screen, select User Type External and then click create:
- Now complete the registration of your app which is fairly simple. Just remember two things:
- Since this is a Testing App, you will have to add some test users (ideally make it the same email through which you are registering the app)
- Add
.../auth/gmail.readonly
scope
-
Create "gmail_credentials.json" file:
- Go to Credentials
- Click
+ CREATE CREDENTIALS > OAuth client ID
- SELECT
Desktop app
as application type - After this a pop up will appear which will have a option to DOWNLOAD OAuth Client JSON file.
- Save the JSON and rename it to
gmail_credentials.json
-
Use the inarrator
-
Chat-GPT Example
gmail = Gmail() gmail.authenticate( credentials_path="gmail_credentials.json", gmail_scope=["https://www.googleapis.com/auth/gmail.readonly"], ) # https://support.google.com/mail/answer/7190 (You can read more about Gmail Filters) emails = gmail.get_latest_emails( gmail_filters="from:(-noreply -no-reply) is:unread -category:social -category:promotions -unsubscribe", # gmail_max_emails="30", ) os.environ['OPENAI_API_KEY'] = '' model = GPTModel(model_name = 'gpt-3.5-turbo-16k') documents = [] for email in emails: documents.append(email) print(model.summarize(documents))
-
Hugging Face Hub Example
gmail = Gmail() gmail.authenticate( credentials_path="gmail_credentials.json", gmail_scope=["https://www.googleapis.com/auth/gmail.readonly"], ) emails = gmail.get_latest_emails( gmail_filters="from:(-noreply -no-reply) is:unread -category:social -category:promotions -unsubscribe", gmail_max_emails="30", ) model = HuggingFaceModel(api_token="",model_name="tuner007/pegasus_summarizer") print(model.summarize(emails[0])) # Hugging Face Hub Models currently can summarize one email at a time.
Outlook
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
inarrator-0.0.2.tar.gz
(9.7 kB
view hashes)
Built Distribution
inarrator-0.0.2-py3-none-any.whl
(11.5 kB
view hashes)
Close
Hashes for inarrator-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1c7414b93e356550f05fb33198d869eb153bea628f5b519070d5f06ef6b8323 |
|
MD5 | 4c8753351eac94fc5fb8ca8062bf461f |
|
BLAKE2b-256 | 3b83d3faa211e67bbcb7c0229045cdc60737b531c749e694c44e903547e98c34 |