The goal of this project is to create a service that sends daily text messages about free food events on campus.
Students at Mines receive a daily newsletter called "The Daily Blast". Many events offering free food are included, but the lengthy email is rarely read in its entirety by students. To address this, we leveraged the OpenAI API to summarize the email and send a text message highlighting events with free food.
A diagram of the architecture can be found in cleanPlate.png.
- Pub/Sub: A daily timer using GCP triggers at 7:00 am, initiating the process on a Linux virtual machine.
- Sponge: An API call is made to ScaleSerp to scrape the Daily Blast. The raw HTML is stored in
rawBlast.txt
. - Soap: BeautifulSoup is used to parse the HTML. The extracted text is saved in
cleanBlast.txt
, and a log of all links is saved inrawLinks.txt
. - fullEmail-gpt: The script reads
cleanBlast.txt
and asks GPT-3 which events offer free food. These events are saved inevents.txt
. - link-finder: Matches events with free food to their corresponding links. The event links are saved in
cleanLinks.txt
. - event-gpt: For each event, another OpenAI call is made to obtain the time, date, and location. These details are saved in
finalSMS.txt
. - twilio: Uses the Twilio API to send the final SMS to our phone numbers.
These components were initially developed as separate files but were eventually consolidated into functions within a single script.
This program saved us an estimated $200 in food costs. However, the project eventually fizzled out due to inconsistent results from the OpenAI calls and depletion of API credits.
This project was developed to refresh and learn the following technologies:
- Python
- Google Cloud Platform (GCP)
- Web Scraping
- API calls
- HTML parsing with BeautifulSoup
- Prompt Engineering
GCP had a steeper learning curve than expected. Porter focused on GCP, while Zach contributed to most of the smaller components and the overall architecture.