Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,18 @@
|
|
1 |
from crewai import Agent, Task, Crew, LLM
|
2 |
import gradio as gr
|
|
|
3 |
|
4 |
-
|
5 |
-
|
|
|
|
|
6 |
|
7 |
llm_model = LLM(model="groq/llama-3.3-70b-versatile")
|
8 |
|
9 |
# Researcher Agent
|
10 |
researcher = Agent(
|
11 |
role="Researcher",
|
12 |
-
goal="Gather comprehensive and accurate information on
|
13 |
backstory="An expert in data collection, analysis, and extracting insights from various sources.",
|
14 |
llm=llm_model
|
15 |
)
|
@@ -32,9 +35,9 @@ def create_crew():
|
|
32 |
|
33 |
# Research Task
|
34 |
research_task = Task(
|
35 |
-
description="Conduct in-depth research on
|
36 |
agent=researcher,
|
37 |
-
expected_output='Detailed and accurate information on
|
38 |
)
|
39 |
|
40 |
# Writing Task
|
@@ -60,18 +63,20 @@ def create_crew():
|
|
60 |
return crew_team
|
61 |
|
62 |
def execute_crew(input_text):
|
63 |
-
"""Executes the CrewAI workflow."""
|
64 |
-
|
|
|
65 |
result = crew_team.kickoff()
|
|
|
66 |
return result
|
67 |
|
68 |
# Gradio Interface
|
69 |
interface = gr.Interface(
|
70 |
fn=execute_crew,
|
71 |
-
inputs=gr.Text(value="
|
72 |
outputs="text",
|
73 |
title="Crew AI - Research and LaTeX Report Generator",
|
74 |
-
description="
|
75 |
)
|
76 |
|
77 |
if __name__ == "__main__":
|
|
|
1 |
from crewai import Agent, Task, Crew, LLM
|
2 |
import gradio as gr
|
3 |
+
import os
|
4 |
|
5 |
+
|
6 |
+
|
7 |
+
def create_crew(topic):
|
8 |
+
"""Creates a CrewAI team with specialized agents for any research topic."""
|
9 |
|
10 |
llm_model = LLM(model="groq/llama-3.3-70b-versatile")
|
11 |
|
12 |
# Researcher Agent
|
13 |
researcher = Agent(
|
14 |
role="Researcher",
|
15 |
+
goal=f"Gather comprehensive and accurate information on the topic: {topic}.",
|
16 |
backstory="An expert in data collection, analysis, and extracting insights from various sources.",
|
17 |
llm=llm_model
|
18 |
)
|
|
|
35 |
|
36 |
# Research Task
|
37 |
research_task = Task(
|
38 |
+
description=f"Conduct in-depth research on {topic}.",
|
39 |
agent=researcher,
|
40 |
+
expected_output=f'Detailed and accurate information on {topic}.'
|
41 |
)
|
42 |
|
43 |
# Writing Task
|
|
|
63 |
return crew_team
|
64 |
|
65 |
def execute_crew(input_text):
|
66 |
+
"""Executes the CrewAI workflow for the given topic."""
|
67 |
+
print("Executing CrewAI with input:", input_text)
|
68 |
+
crew_team = create_crew(input_text)
|
69 |
result = crew_team.kickoff()
|
70 |
+
print("CrewAI Output:", result)
|
71 |
return result
|
72 |
|
73 |
# Gradio Interface
|
74 |
interface = gr.Interface(
|
75 |
fn=execute_crew,
|
76 |
+
inputs=gr.Text(value="Enter a topic for research", interactive=True, placeholder="e.g., Quantum Computing"),
|
77 |
outputs="text",
|
78 |
title="Crew AI - Research and LaTeX Report Generator",
|
79 |
+
description="Enter any topic, and the AI team will research and generate a LaTeX report based on it."
|
80 |
)
|
81 |
|
82 |
if __name__ == "__main__":
|