Create Your Brand Songs and Level Up your marketing with this tool!!
Published: 2024-05-20 06:46:29

In today's digital age, marketing strategies continually evolve to capture the attention of consumers. One creative approach involves crafting catchy song lyrics to promote brands effectively. In this blog post, we'll explore how to develop a Brand Song Lyrics Generator using Streamlit, a popular Python library for building web applications, and Lyzr Automata, a powerful tool for Agentic AI SDK.

**Why Brand Songs?**
Brand songs, also known as jingles or sonic branding, can have a significant impact on marketing in several ways:

**1. Memorability:** A catchy brand song can stick in people's minds long after they've heard it. This creates top-of-mind awareness, making consumers more likely to think of the brand when making purchasing decisions.
**2. Emotional Connection:** Music has a powerful ability to evoke emotions. A well-crafted brand song can evoke positive emotions and create a strong emotional connection with consumers, fostering loyalty and brand affinity.
**3. Brand Recognition:** Just like a logo or a slogan, a brand song can serve as a key element of a brand's identity. When consumers hear the song, they immediately associate it with the brand, reinforcing brand recognition.
**4. Differentiation:** In a crowded marketplace, a unique brand song can help a company stand out from the competition. It becomes a distinctive element of the brand's identity that sets it apart from others in the same industry.
**5. Consistency Across Platforms:** A brand song can be used across various marketing channels, from TV and radio commercials to online ads and social media content. This consistency helps reinforce the brand message and identity across different touchpoints.
**6. Extension of Brand Personality:** The style, tone, and lyrics of a brand song can reflect the personality and values of the brand. This helps to further communicate the brand's identity and connect with its target audience on a deeper level.
**7. Increased Engagement:** Brand songs can enhance consumer engagement by encouraging participation. For example, if the song has a memorable chorus or a catchy hook, consumers may find themselves singing along or sharing the song with others, thereby extending the brand's reach.
**8. Longevity:** A well-crafted brand song can have a long lifespan, remaining relevant and effective for years or even decades. This provides long-term value to the brand and can contribute to its overall marketing strategy.

**Setting Up the Environment**
**Imports:**
Imports necessary libraries: os, streamlit, libraries from lyzr_automata

```
pip install lyzr_automata streamlit
```

```
import streamlit as st
from lyzr_automata.ai_models.openai import OpenAIModel
from lyzr_automata import Agent,Task
from lyzr_automata.pipelines.linear_sync_pipeline import LinearSyncPipeline
from PIL import Image
```
**OpenAI API Key:**

```
api = st.sidebar.text_input("Enter Your OPENAI API KEY HERE",type="password")
```
api = st.sidebar.text_input("Enter Your OPENAI API KEY HERE",type="password") Creates a text input field in the sidebar where users can enter their OpenAI API key securely (password mode).

**OpenAI Model Setup :**

```
if api:
    open_ai_text_completion_model = OpenAIModel(
        api_key=api,
        parameters={
            "model": "gpt-4-turbo-preview",
            "temperature": 0.2,
            "max_tokens": 1500,
        },
    )
else:
    st.sidebar.error("Please Enter Your OPENAI API KEY")
```
if api: This block executes only if the user has entered an API key.
open_ai_text_completion_model = OpenAIModel(): Creates an instance of the OpenAIModel class with the provided API key and sets the model parameters like "gpt-4-turbo-preview" for the text generation model, temperature for randomness, and maximum token limit.
else: If no API key is provided, an error message is displayed in the sidebar using st.sidebar.error().

**lyrics_writer function:**

```
def lyrics_writer(name, description, idea, language):
    marketing_agent = Agent(
        prompt_persona="You Are Expert Marketing Manager",
        role="Marketing Expert",
    )

    song_task = Task(
        name="JS API Integration",
        output_type=OutputType.TEXT,
        input_type=InputType.TEXT,
        model=openai_model,
        agent=marketing_agent,
        log_output=True,
        instructions=f"""Your Are an Expert Marketing Officer and Part Time Lyrics Writer. Your Task is to Generate a Lyrics for Given Details:
        Product Name: {name}
        Product Description: {description}
        Idea for Song: {idea}
        Language: {language}
        """,
    )

    output = LinearSyncPipeline(
        name="Generate Lyrics",
        completion_message="Lyrics Generated!",
        tasks=[
            song_task
        ],
    ).run()
    return output[0]['task_output']
```
Agent: Defines an Agent object with a prompt persona and role for marketing expertise.
Task: Defines a Task object specifying the task name, output and input types, model to be used (the OpenAI model created earlier), agent, logging output, and instructions containing placeholders for user-provided details.
LinearSyncPipeline: Creates a pipeline named "Generate Lyrics" with a completion message and a list containing the defined task.
This pipeline likely executes the defined task and retrieves the output.
return output[0]['task_output']: Returns the task output from the pipeline execution, which is likely the generated song lyrics.

**User Input Fields:**

```
name = st.text_input("Brand Name", placeholder="Samsung")
description = st.text_input("Description", placeholder="We are selling Phones which is best in the world")
idea = st.text_input("Idea for Song")
language = st.text_input("Language", placeholder="Italian")
```
st.text_input(): Creates separate text input fields for users to enter their brand name, description, idea for the song, and language preference.

**Generate Button and Output Display:**

```
if api and st.button("Generate"):
    solution = lyrics_writer(name, description, idea, language)
    st.markdown(solution)
```
if statement: Checks if both api has a value (API key entered) and the "Generate" button is clicked.
If True: Calls the lyrics_writer function with user-provided details and stores the returned output (generated lyrics) in the solution variable.
Displays the generated lyrics using st.markdown().

try it now: [https://lyzr-marketing-lyrics.streamlit.app/](https://lyzr-marketing-lyrics.streamlit.app/)
For more information explore the website: [Lyzr](https://www.lyzr.ai/)
Github: [https://github.com/harshit-lyzr/markeing_song/](https://github.com/harshit-lyzr/markeing_song/)