-
Notifications
You must be signed in to change notification settings - Fork 0
/
Content_Marketing.py
102 lines (83 loc) · 3.84 KB
/
Content_Marketing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import streamlit as st
import json
import boto3
from crewai import Agent, Task, Crew, Process
import os
from langchain_google_genai import ChatGoogleGenerativeAI
def get_secrets(parameter):
session = boto3.session.Session(profile_name='javacoder')
client = session.client('ssm', region_name='us-east-1')
secret_key = parameter
response = client.get_parameter(Name=secret_key, WithDecryption=True)
return json.dumps(response['Parameter']['Value'])
st.subheader("Gen-Marketer")
api_gemini = get_secrets('google_api_token')
llm = ChatGoogleGenerativeAI(
model="gemini-pro", verbose=True, temperature=0.1, api_gemini=api_gemini
)
# print(type(api_gemini))
# print(api_gemini)
# exit()
market_researcher = Agent(
role = 'Market Researcher',
goal='Research new and emerging trends in pet products industry in Germany',
backstory = 'You are a market researcher in the pet product industry',
verbose= True,
allow_delegation= False,
#llm = an llm of your choice can be taken, but default is chatgpt or gpt 3.5
#llm= ChatOpenAI(model_name="gpt-3.5", temperature=0.7)#ollama_openhermes
llm=llm
)
campaign_creator = Agent(
role = 'Marketing Campaign Creator',
goal='Come up with 3 interesting marketing campaign ideas in the pet product industry based on market research insights',
backstory = 'You are a marketing campaign planner in the pet product industry',
verbose= True,
allow_delegation= False,
#llm = an llm of your choice can be taken, but default is chatgpt or gpt 3.5
llm=llm
)
digital_marketer = Agent(
role = 'Digital Marketing Content Creator',
goal='Come up with 2 or 3 interesting advertisement ideas for marketing on digital platforms such as Youtube, Instagram amd Tiktok along with script for each marketing campaign',
backstory = 'You are a marketing marketer specialising in performance marketing in the pet product industry',
verbose= True,
allow_delegation= False,
#llm = an llm of your choice can be taken, but default is chatgpt or gpt 3.5
#llm=ChatOpenAI(model_name="gpt-3.5", temperature=0.7) #ollama_openhermes
llm=llm
)
prompt = st.text_area("What Market Research Task would You like me to do Today?")
task1 = Task(description=prompt, agent=market_researcher, expected_output="A bullet list summary of the top 5")
prompt = st.text_area("What Marketing Campaigns would You like me to come up with Today?")
task2 = Task(description=prompt, agent=campaign_creator, expected_output="A bullet list summary of the top 5")
prompt = st.text_area("What Digital Marketing Content would You like me to generate Today?")
task3 = Task(description=prompt, agent=digital_marketer, expected_output="A bullet list summary of the top 5")
# textos a preencher
# What are the trends in real estate marketing, which can be done in a simple way, by independent real estate agents
# Create content that encourages only qualified leads to get in touch
# Create blog posts with great SEO to rank on Google
# Create crew
crew = Crew(
agents=[market_researcher,campaign_creator,digital_marketer],
tasks=[task1,task2,task3],
verbose = 2,
process = Process.sequential
)
# query answering
if st.button("Generate"):
#if prompt:
# call pandas_ai.run(), passing dataframe and prompt
with st.spinner("Generating response..."):
#if 'show' or 'plot' or 'graph' in prompt:
# plot = pandas_ai.run(option, prompt) #option.chat(prompt)
# st.pyplot(plot.fig)
#else:
#option = SmartDataframe(option, config={"llm": llm})
st.write(crew.kickoff())
st.write(task1.output)
st.write(task2.output)
st.write(task3.output)
#(option.chat(prompt)) #(pandas_ai.run(option, prompt))
#else:
# st.warning("Please enter a prompt.")