eaglelandsonce commited on
Commit
d2ca388
1 Parent(s): 6c62b46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -58
app.py CHANGED
@@ -1,61 +1,45 @@
1
-
2
  from crewai import *
3
-
4
- import os
5
-
6
-
7
- os.environ["OPENAI_API_KEY"] = "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"
8
-
9
-
10
- # Define your agents with roles and goals
11
- researcher = Agent(
12
- role='Senior Research Analyst',
13
- goal='Uncover cutting-edge developments in AI and data science in',
14
- backstory="""You are a Senior Research Analyst at a leading tech think tank.
15
- Your expertise lies in identifying emerging trends and technologies in AI and
16
- data science. You have a knack for dissecting complex data and presenting
17
- actionable insights.""",
18
- verbose=True,
19
- allow_delegation=False
20
-
21
- )
22
- writer = Agent(
23
- role='Tech Content Strategist',
24
- goal='Craft compelling content on tech advancements',
25
- backstory="""You are a renowned Tech Content Strategist, known for your insightful
26
- and engaging articles on technology and innovation. With a deep understanding of
27
- the tech industry, you transform complex concepts into compelling narratives.""",
28
- verbose=True,
29
- allow_delegation=False
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  )
31
 
32
- # Create tasks for your agents
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()