Create AI Blogging Assistant app using Gemini Pro and DALLE 3
Introduction
Do you have a dream of writing great blog posts and having posters that would almost write the blog posts for you? Welcome to the AI Blog Companion, Let enter the world of powerful and smart writing partners of artificial intelligence. Say bye-bye to writer’s block and hello to the blogger within you with the click of a button.

Project Overview
For the presented project, we will be utilizing Streamlit as the interface for the users; Gemini Pro will be used for creative descriptions; DALL-E 3 will bring to life unique and beautiful images. It is a dream team blogging that is prepared to assist you in making blogs that are outstanding.

Environment Setup
Firstly, create a new folder named “AI_blog_companion” on your desktop and open the folder in VS Code.

Then create two files called “API_keys.py” and “app.py”

Add the following code to “API_keys.py”:
google_api_key = “your_google_api_key”
Designing the Frontend
As our first step, let’s implement the structure of the frontend of our application with the help of the Streamlit library. Inside our app.py file there will be code for a title for the given input, the second will be the subheader, the third will be a sidebar. The user will enter the blog title, which keywords to use, the number of words for the blog, and how many images they would like.
Some part of the code snippet is provided below:
import streamlit as st
# Title of our app
st.title(‘đź“ť Blogcraft: Your AI Writing Companion’)
# Create a subheader
st.subheader(“Now you can craft perfect blogs with the help of AI – Blogcraft is your New AI Blog Companion”)
with st.sidebar:
st.title(“Input Your Blog Details”)
st.subheader(“Enter Details of the Blog You want to generate”)

The above code is going to generate the following output:

Setting Up the Main Logic
As a second step, the main application will be designed and implemented with the help of Google developed Gemini Pro model. a system prompt will be created to produce an inclusive and appealing blog post with reference to the title and keywords. The blog post should be of the approximate length of the indicated number of words.
Following is some part of the code:
import openai
import requests
from API_keys import openai_api_key# Set up OpenAI API client
openai.api_key = openai_api_key# Define function to generate blog post
def generate_blog_post(blog_title, keywords, num_words):
# Generate text
response = openai.Completion.create(
engine=”davinci”,
prompt=f”Write a blog post about {blog_title} with the following keywords: {keywords}. The blog post should be approximately {num_words} words long and suitable for an online audience. Ensure the content is original, informative, and maintains a consistent tone throughout.”,
max_tokens=num_words,
n=1,
stop=None,
temperature=0.5
)
text = response.choices[0].text.strip()
return text
Integrating Open AI‘s DALL-E 3
The DALL-E 3 model from Open AI will be employed to perform the image generation. Here I will outline a plan on how to exercise the client and what image will be created from the prompt. We will also construct a list of image URL Strings and then show them in a carousel using Streamlit’s carousel library.

Running the Application
To run the application, navigate to the directory where your app.py file is located and run:
Testing the Application
Lets try a sample of blog titles, keywords of interest, and image recommendations. Following the creation of the blog post, we will have the outcomes and these are the Slideshow of images and the Blog post with introduction, ten main points, and conclusion.





In this project, Gemini Pro and Dolly 3 helped us to design an AI blog companion which can write outstanding blog contents with great illustrations. I do hope this blog has been of some value to your learning.