This project was made using the repo privateGPT. We have integrated web scrapping for your gmails using a script that you can log into.
Our work uses the following software:
Whenever I say that you need to run the script, I am assuming you know that to run a script you would do:
chmod u+x script.sh
#then
./script.sh
git clone https://github.com/MostlyKIGuess/mAI-Mail.git && cd mAI-Mail && \
python3.11 -m venv .venv && source .venv/bin/activate && \
pip install --upgrade pip poetry && poetry install --with ui,local && ./scripts/setup
# Launch the privateGPT API server **and** the gradio UI
poetry run python3.11 -m private_gpt
# In another terminal, create a new browser window on your private GPT!
open http://127.0.0.1:8001/
source .venv/bin/activate
## and launch
poetry run python3.11 -m private_gpt
## now open web browser
open http://127.0.0.1:8001/
make wipe #inside the directory
To use this web scrapper, you need a credentials.json
file for authenticating with the Gmail API. Here's how you can get it:
Go to the Google Cloud Console.
Click on "Select a project" at the top of the page, then click on "New Project", and create a project.
Once the project is created, select it.
In the left-hand menu, go to "APIs & Services" > "Library".
Search for "Gmail API" and click on it.
Click "Enable" to enable the Gmail API for your project.
In the left-hand menu, go to "APIs & Services" > "Credentials".
Click on "Create Credentials" > "OAuth client ID".
If you haven't configured the OAuth consent screen yet, you'll be asked to do so. Fill in the required fields. You can set the "User Type" to "External" for testing purposes.
Once the OAuth consent screen is configured, you'll be able to create the OAuth client ID. Set the "Application type" to "Desktop app", give it a name, and click "Create".
You'll see a screen with your client ID and client secret. Click "OK".
Back in the "Credentials" screen, you'll see your new OAuth 2.0 Client ID. Click on the download icon on the right to download your credentials.json
file.
Move the credentials.json
file to the ./scrapper
directory of this project.
Now you need to run the python file pythongmail.py, make sure to do it from the parent directory and not the same directory.And you will get your scrapped data on a file name threads.txt.
Then run the threadcopy.sh to trasnfer data to it's place where it could be ingested.
If you are facing an error of email scrapping failed, be sure to install google-api-python-client lib by doing:
pip install --user google-api-python-client
or just this if you are in venv, which you should be for your safety.
pip install google-api-python-client
This is the script to do everything at the same time, if it's not working for you because of TMux issue, just do the each step manually then you can move to the second step again and then you just have to do the poetry again.
You need TMux to run the final.sh
script which runs every script I have mentioned above that is if you want it to directly run by just one click. :)
This script basically scrapped your data first, puts it the data folder, then ingests the data and then brews the server and then opens the server for you.
If you are having trouble running this , run the scripts alone to figure out what's wrong, feel very free to create issue I will reply as soon as possible. Also this might be useful : https://tmuxcheatsheet.com/
Thanks to my friends as well. :)