I made an AI to send you newspapers from a randomly made up world. (1/4)

So, I have been getting this Idea since long that “ What If I make a newspaper that gives news of some other world”. And thats how we are…

I made an AI to send you newspapers from a randomly made up world. (1/4)

DALL-E 2

So, I have been getting this Idea since long that “ What If I make a newspaper that gives news of some other world”. And thats how we are here today.

First lets see what exactly does a Newspaper need?

https://en.wikipedia.org/wiki/Newspaper

It needs a:

  • Punchy Headline
  • Many Small articles
  • A Good Name
  • Awesome font styles

On this part lets work on what I will call “The Headline Generator”. Its pretty simple I think I am going to use a a dataset with headlines and custom train a GPT-2 model.

Lets get started:

Lets make an AI to generate headlines.

First the imports:

Lets get the news url I am using for the dataset:

Lets make a print headlines function:

Lets get the current headlines of the world:

So its getting headlines but not all headlines as the websites don’t load all at once. To load it all at once lets add a force load feature:

504 news headlines

Lets get the compiled .csv file from my gdrive:

Lets read the csv file and delete the unwanted columns:

Now lets start custom training the GPT-2 model:

Lets get the aitextgen lib:

Setting up the tensor flow GPT-2 124 Million parameters model:

Adding the dataset and fitting it for training:

Preparing the dataset:

Size of the dataset is 1244184

Saving the cleaned text .csv:

Mounting my gdrive:

Training the GPT-2 model:

It took about 31 minutes

Saving the trained model in my drive:

Now the lets use the model and generate the headlines:

headlines:
labor calls for inquiry into botched robbery
labor says abc canberra hospital is a labor promises to block new iraqi pm
labor to hold key polls in nsw labor to vote
==========
headlines:
clive palmer to visit the country hour
clive palmer to visit the country
clive palmer to visit the riverina cooper cronk councils to consider newcastle cbd ==========
headlines:
police arrest man over attack on women
police arrest man over alleged sexual misconduct
police call off search for missing teen police plead for help in search for missing police seek help in search for missing man police seek help
==========
headlines:
interview david rann
interview johnathan thurston interview michael klinger
interview michael clarke
interview trent robinson
interview trent robinson
==========
headlines: nasa launches mars mission
nasa to mars mars mars mars
nasa to mars mars mars moon newcastle mp backs nt government to cut funds newcastle police minister newman says north west link plan

Thats some banger headlines😁. Lets make a article generator in the next part.

I was on a break for two weeks. Thanks for waiting .

For the code go here:

For my day to day AIML updates follow me on twitter:

Thanks for reading 😁, See ya guys next week 👋🏼