Spaces:
Sleeping
Sleeping
Commit
·
d2ca388
1
Parent(s):
6c62b46
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,61 +1,45 @@
|
|
| 1 |
-
|
| 2 |
from crewai import *
|
| 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 |
-
task1 = Task(
|
| 34 |
-
description="""Conduct a comprehensive analysis of the latest advancements in AI in 2024.
|
| 35 |
-
Identify key trends, breakthrough technologies, and potential industry impacts.
|
| 36 |
-
Compile your findings in a detailed report. Your final answer MUST be a full analysis report""",
|
| 37 |
-
agent=researcher
|
| 38 |
-
)
|
| 39 |
-
|
| 40 |
-
task2 = Task(
|
| 41 |
-
description="""Using the insights from the researcher's report, develop an engaging blog
|
| 42 |
-
post that highlights the most significant AI advancements.
|
| 43 |
-
Your post should be informative yet accessible, catering to a tech-savvy audience.
|
| 44 |
-
Aim for a narrative that captures the essence of these breakthroughs and their
|
| 45 |
-
implications for the future. Your final answer MUST be the full blog post of at least 3 paragraphs.""",
|
| 46 |
-
agent=writer
|
| 47 |
-
)
|
| 48 |
-
|
| 49 |
-
# Instantiate your crew with a sequential process
|
| 50 |
-
crew = Crew(
|
| 51 |
-
agents=[researcher, writer],
|
| 52 |
-
tasks=[task1, task2],
|
| 53 |
-
verbose=2, # Crew verbose more will let you know what tasks are being worked on, you can set it to 1 or 2 to different logging levels
|
| 54 |
-
process=Process.sequential # Sequential process will have tasks executed one after the other and the outcome of the previous one is passed as extra content into this next.
|
| 55 |
-
)
|
| 56 |
-
|
| 57 |
-
# Get your crew to work!
|
| 58 |
-
result = crew.kickoff()
|
| 59 |
-
|
| 60 |
-
print("######################")
|
| 61 |
-
print(result)
|
|
|
|
|
|
|
| 1 |
from crewai import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
def run_crew():
|
| 5 |
+
researcher = Agent(
|
| 6 |
+
role='Senior Research Analyst',
|
| 7 |
+
goal='Uncover cutting-edge developments in AI and data science',
|
| 8 |
+
backstory="""You are a Senior Research Analyst at a leading tech think tank...""",
|
| 9 |
+
verbose=True,
|
| 10 |
+
allow_delegation=False
|
| 11 |
+
)
|
| 12 |
+
writer = Agent(
|
| 13 |
+
role='Tech Content Strategist',
|
| 14 |
+
goal='Craft compelling content on tech advancements',
|
| 15 |
+
backstory="""You are a renowned Tech Content Strategist...""",
|
| 16 |
+
verbose=True,
|
| 17 |
+
allow_delegation=False
|
| 18 |
+
)
|
| 19 |
+
task1 = Task(
|
| 20 |
+
description="""Conduct a comprehensive analysis of the latest advancements in AI in 2024...""",
|
| 21 |
+
agent=researcher
|
| 22 |
+
)
|
| 23 |
+
task2 = Task(
|
| 24 |
+
description="""Using the insights from the researcher's report, develop an engaging blog post...""",
|
| 25 |
+
agent=writer
|
| 26 |
+
)
|
| 27 |
+
crew = Crew(
|
| 28 |
+
agents=[researcher, writer],
|
| 29 |
+
tasks=[task1, task2],
|
| 30 |
+
verbose=2,
|
| 31 |
+
process=Process.sequential
|
| 32 |
+
)
|
| 33 |
+
result = crew.kickoff()
|
| 34 |
+
return result
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
iface = gr.Interface(
|
| 38 |
+
fn=run_crew,
|
| 39 |
+
inputs=[],
|
| 40 |
+
outputs="text",
|
| 41 |
+
title="AI Research and Writing Crew",
|
| 42 |
+
description="Run a crew of AI agents to perform research and writing tasks."
|
| 43 |
)
|
| 44 |
|
| 45 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|