File size: 4,539 Bytes
1e2617e 4fd500e 1e2617e 4fd500e |
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 |
import streamlit as st
from src.components.process import all_crew
from dotenv import load_dotenv
load_dotenv()
class ContentGenerationUI:
def generate_content(self, topic):
inputs = {
"topic": topic
}
result = all_crew.kickoff(inputs=inputs)
return result
def content_generation(self):
if st.session_state.generating:
st.session_state.content_generator = self.generate_content(
st.session_state.topic)
if st.session_state.content_generator and st.session_state.content_generator != "":
with st.container():
st.write("Content generated successfully!")
st.download_button(
label="Download Markdown file",
data=st.session_state.content_generator,
file_name="content_generate.md",
mime="text/markdown"
)
st.session_state.generating = False
def sidebar(self):
with st.sidebar:
st.title("Content Generator Tool")
st.write("This workflow should autonomously process input topics, conduct research, plan content, generate images, optimize for SEO, and perform final editorial checks.")
topic = st.text_area(
label="Enter the topic: ",
placeholder="Enter the name of the topic to generate the article",
key="topic",
height=175
)
st.write(f'You wrote {len(topic.split())} words.')
if st.button("Generate Content"):
st.session_state.generating = True
def render(self):
st.set_page_config(page_title="Content Generation", page_icon="📃")
tab1, tab2 = st.tabs(["Output", "About Project"])
# This is sidebar section
self.sidebar()
with tab2:
st.markdown("# About project")
st.write(
"""
### Project Description
Implementing a scalable content team using AI involves creating a framework that blends the strengths of AI technologies with the creative and supervisory capabilities of human team members. This strategy aims to enhance efficiency, creativity, and content output quality.
This code is a high-level conceptualization and would require adaptation to fit the actual CrewAI framework and toolset specifics. It illustrates how different AI agents, equipped with specialized roles and tools, can collaborate within a content creation process. Each agent focuses on a key area—research, writing, and SEO—streamlining the content development workflow and enhancing output quality through specialized AI-driven tasks.
### Objective
Implement a content generation workflow using the Crew AI framework. This workflow should autonomously process input topics, conduct research, plan content, generate images, optimize for SEO, and perform final editorial checks.
### Tools and Frameworks:
* Crew AI framework
* Streamlit - User Interface(UI)
* Python for scripting
* AI models or APIs (e.g., `gemini-pro` for content, `stable-diffusion-xl-base` for images)
### Prerequisites
To complete this project, you should understand Python programming, data manipulation, visualization libraries such as Pandas and Matplotlib, and machine learning libraries such as Scikit-Learn. Additionally, some background knowledge of natural language processing (NLP) techniques and generate text to image and image to text methods would be helpful.
### Resources
- Live demo link: [Content Generate - WebApp]()
- Check out [CrewAI](https://docs.crewai.com/)
- Project code [GitHub](https://github.com/Bhavik-Jikadara/Content-Generation-Workflow)
"""
)
with tab1:
# Initialize the app session state
if "topic" not in st.session_state:
st.session_state.topic = ""
if "content_generator" not in st.session_state:
st.session_state.content_generator = ""
if "generating" not in st.session_state:
st.session_state.generating = False
self.content_generation()
if __name__ == "__main__":
ContentGenerationUI().render()
|