News2Pic
Have you ever wondered how the top news headlines would look as a single image? No? No, neither have I, but here's a way to do it (and automate it to run daily).
Azure Resources
- Key vault
- Databricks service, with key vault-backed secret scope set.
- Databricks compute cluster with requisite Python libraries installed.
- Databricks notebook created and attached to cluster.
- Storage account (Datalake blob), set to the static website capability and Databricks access via secret scope and personal access token.
- Bing Search service, Databricks access to endpoint via secret scope key stored in key vault.
- Language service, Databricks access to endpoint via secret scope key stored in key vault.
- OpenAI service, Databricks access to endpoint via secret scope key stored in key vault.
- Data Factory, a pipeline with a single activity linked to the Databricks notebook and set to trigger daily.
Databricks Notebook (Python)
- Get news headlines via Bing Search API.
- Extract key phrases from headlines via Azure AI Language API. (What's with the puppy? See PupperSpotter below ...)
- Generate image via OpenAI Dall-E, using key phrases as the text prompt.
- Add meta details to JSON log.
- Copy generated image and JSON log to web app folder (of this website). (This page uses jQuery to retrieve the latest image and JSON meta data.)
Datestamp | |
Headlines | |
Key phrases | |
Error message | |