This programme allows to get preview images for journalistic articles from "WashingtonPost", "CNN" or "The Guardian" websites with the use of the Facebook BART text generation model, the zephyr-7b-beta promt generation model and the 8-steps SDXL-Lightning stable diffusion model.
git clone https://github.com/KyryloTurchyn/NewsImageGeneration
pip install -r requirements.txt
Since image generation is done using CUDA, you will need to activate it. You can use the official Pytorch website, but for Windows it will probably be:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
After that, you will need to go to the directory and run app.py
cd pythonProject
python app.py
pythonProject/
│
├── Models/
│ ├── __init__.py # Initializes the Models package
│ ├── PromptModel.py # Module for the prompt generation model
│ ├── StableDiffusionModel.py # Module for the stable diffusion model
│ └── SummarizationModel.py # Module for the text summarization model
│
├── static/
│ └── output.png # Static image file for the web interface
│
├── templates/
│ └── index.html # HTML template for the main page of the web application
│
└── Utils/
├── __init__.py # Initializes the Utils package
└── ParserClass.py # Module with parser class
│
└── app.py # Main file for the Flask application
└── logic.py # Module containing the business logic of the application
- Parsing - you pass a link to the article into the code. Then all the text from the site is parsed.
- Summarization - for the prompt model to generate a good prompt, we need to summarise the text.
- Prompting - on the basis of summery and base prompt a separate prompt is prepared in the image generation model
- Image Generation - the image is generated on the basis of the existing promt, which is specially generated for the preview photo.
Trump in ‘full sprint’ to close Biden’s money lead as legal bills mount
Irish moonshine and the village that declared itself an outlaw republic
Original cover art for ‘Harry Potter and the Philosopher’s Stone’ expected to set auction record
Who was Alexei Navalny, Russian opposition leader and Putin critic?