Update app.py
Browse files
app.py
CHANGED
|
@@ -32,22 +32,32 @@ else:
|
|
| 32 |
def crewai_process(research_topic):
|
| 33 |
# Define your agents with roles and goals
|
| 34 |
author = Agent(
|
| 35 |
-
role='
|
| 36 |
goal="""Use language and style throughout that is simple, clear, and appealing to children,
|
| 37 |
including elements like repetition and rhymes. Remember to keep the story age-appropriate in both length and content.""",
|
| 38 |
backstory="""You embody the spirit of a seasoned children's story author, whose life experiences and passions are
|
| 39 |
deeply woven into the fabric of your enchanting tales.""",
|
| 40 |
verbose=True,
|
| 41 |
allow_delegation=True,
|
| 42 |
-
llm = gemini_llm
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
)
|
| 48 |
|
| 49 |
artist = Agent(
|
| 50 |
-
role='
|
| 51 |
goal="""Visually bring stories to life. Create images that complement and enhance the text,
|
| 52 |
helping to convey the story's emotions, themes, and narrative to the reader.""",
|
| 53 |
backstory="""You grew into a passionate artist with a keen eye for storytelling through visuals.
|
|
@@ -124,21 +134,34 @@ def crewai_process(research_topic):
|
|
| 124 |
)
|
| 125 |
|
| 126 |
task2 = Task(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
description="""Summarize the author story into an image prompt.""",
|
| 128 |
agent=artist
|
| 129 |
)
|
| 130 |
|
| 131 |
-
|
| 132 |
description="""create a rhyming version of the story created by the author""",
|
| 133 |
agent=poet
|
| 134 |
)
|
| 135 |
|
| 136 |
-
|
| 137 |
description="""create a rhyming version of the story created by the author""",
|
| 138 |
agent=reader
|
| 139 |
)
|
| 140 |
|
| 141 |
-
|
| 142 |
description="""output both the story created by the author and the poem created by the poet,
|
| 143 |
make sure you label the story and the poem so you can tell them apart, name the story and poem appropriately """,
|
| 144 |
agent=finalizer
|
|
@@ -149,12 +172,8 @@ def crewai_process(research_topic):
|
|
| 149 |
|
| 150 |
# Instantiate your crew with a sequential process
|
| 151 |
crew = Crew(
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
# agents=[author, artist, poet, finalizer ],
|
| 155 |
-
# tasks=[task1, task2, task3, task5],
|
| 156 |
-
agents=[author, poet, finalizer],
|
| 157 |
-
tasks=[task1, task3, task5],
|
| 158 |
verbose=2,
|
| 159 |
process=Process.sequential
|
| 160 |
)
|
|
|
|
| 32 |
def crewai_process(research_topic):
|
| 33 |
# Define your agents with roles and goals
|
| 34 |
author = Agent(
|
| 35 |
+
role='Children Story Author',
|
| 36 |
goal="""Use language and style throughout that is simple, clear, and appealing to children,
|
| 37 |
including elements like repetition and rhymes. Remember to keep the story age-appropriate in both length and content.""",
|
| 38 |
backstory="""You embody the spirit of a seasoned children's story author, whose life experiences and passions are
|
| 39 |
deeply woven into the fabric of your enchanting tales.""",
|
| 40 |
verbose=True,
|
| 41 |
allow_delegation=True,
|
| 42 |
+
llm = gemini_llm
|
| 43 |
+
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
editor = Agent(
|
| 47 |
+
role='Children Story Editor',
|
| 48 |
+
goal="""You meticulously refine and elevate each manuscript, ensuring it resonates deeply with its intended audience
|
| 49 |
+
while preserving the author's unique voice.""",
|
| 50 |
+
backstory="""Growing up in a family of writers and teachers, you developed an early love for words and storytelling.
|
| 51 |
+
After completing your degree in English Literature, you spent several years working in a small, independent publishing
|
| 52 |
+
house where you honed my skills in identifying and nurturing literary talent. """,
|
| 53 |
+
verbose=True,
|
| 54 |
+
allow_delegation=False,
|
| 55 |
+
llm = gemini_llm
|
| 56 |
|
| 57 |
)
|
| 58 |
|
| 59 |
artist = Agent(
|
| 60 |
+
role='Storybook Illustrator',
|
| 61 |
goal="""Visually bring stories to life. Create images that complement and enhance the text,
|
| 62 |
helping to convey the story's emotions, themes, and narrative to the reader.""",
|
| 63 |
backstory="""You grew into a passionate artist with a keen eye for storytelling through visuals.
|
|
|
|
| 134 |
)
|
| 135 |
|
| 136 |
task2 = Task(
|
| 137 |
+
description="""From author story perform the following 4 steps completing the Condition2:
|
| 138 |
+
Step 1 - Evaluate the story's themes, language, and messaging to ensure they are appropriate
|
| 139 |
+
and appealing for the target age group.
|
| 140 |
+
Step 2 - Balance simplicity with depth to create a narrative that is both entertaining and educational for young readers.
|
| 141 |
+
Setp 3 - Tailor content to nurture understanding and growth, fostering a connection between the story and its audience.
|
| 142 |
+
Step 4 - Ensure the story is engaging and resonates with children, making it a valuable and enjoyable reading experience.
|
| 143 |
+
Condition2: after the editing is complete output the final story.
|
| 144 |
+
""",
|
| 145 |
+
agent=editor
|
| 146 |
+
)
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
task3 = Task(
|
| 150 |
description="""Summarize the author story into an image prompt.""",
|
| 151 |
agent=artist
|
| 152 |
)
|
| 153 |
|
| 154 |
+
task4 = Task(
|
| 155 |
description="""create a rhyming version of the story created by the author""",
|
| 156 |
agent=poet
|
| 157 |
)
|
| 158 |
|
| 159 |
+
task5 = Task(
|
| 160 |
description="""create a rhyming version of the story created by the author""",
|
| 161 |
agent=reader
|
| 162 |
)
|
| 163 |
|
| 164 |
+
task6 = Task(
|
| 165 |
description="""output both the story created by the author and the poem created by the poet,
|
| 166 |
make sure you label the story and the poem so you can tell them apart, name the story and poem appropriately """,
|
| 167 |
agent=finalizer
|
|
|
|
| 172 |
|
| 173 |
# Instantiate your crew with a sequential process
|
| 174 |
crew = Crew(
|
| 175 |
+
agents=[author, editor],
|
| 176 |
+
tasks=[task1, task2],
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
verbose=2,
|
| 178 |
process=Process.sequential
|
| 179 |
)
|