File size: 2,730 Bytes
c43e87e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from crewai import Agent, Task, Crew, LLM
import gradio as gr

def create_crew():
    """Creates a CrewAI team with specialized agents."""
    
    llm_model = LLM(model="groq/llama-3.3-70b-versatile")
    
    # Researcher Agent
    researcher = Agent(
        role="Researcher",
        goal="Gather comprehensive and accurate information on a given topic.",
        backstory="An expert in data collection, analysis, and extracting insights from various sources.",
        llm=llm_model
    )
    
    # Writer Agent
    writer = Agent(
        role="Writer",
        goal="Summarize research findings into a well-structured and coherent report.",
        backstory="A seasoned writer with expertise in transforming raw information into clear and concise text.",
        llm=llm_model
    )
    
    # LaTeX Document Creator Agent
    latex_creator = Agent(
        role="LaTeX Document Creator",
        goal="Convert the summarized report into a well-formatted LaTeX document.",
        backstory="A skilled document formatter who ensures professional presentation in LaTeX.",
        llm=llm_model
    )
    
    # Research Task
    research_task = Task(
        description="Conduct in-depth research on Machine Learning for effort estimation.",
        agent=researcher,
        expected_output='Detailed and accurate information on Machine Learning in effort estimation.'
    )
    
    # Writing Task
    writing_task = Task(
        description="Based on the research findings, generate a concise and well-structured summary.",
        agent=writer,
        expected_output='A clear and structured summary of the research findings.'
    )
    
    # LaTeX Document Creation Task
    latex_task = Task(
        description="Transform the research summary into a properly formatted LaTeX document.",
        agent=latex_creator,
        expected_output='A LaTeX document containing the summarized research.'
    )
    
    # Assemble the Crew
    crew_team = Crew(
        agents=[researcher, writer, latex_creator],
        tasks=[research_task, writing_task, latex_task]
    )
    
    return crew_team

def execute_crew(input_text):
    """Executes the CrewAI workflow."""
    crew_team = create_crew()
    result = crew_team.kickoff()
    return result

# Gradio Interface
interface = gr.Interface(
    fn=execute_crew,
    inputs=gr.Text(value="Conduct in-depth research on Machine Learning for effort estimation.", interactive=False),
    outputs="text",
    title="Crew AI - Research and LaTeX Report Generator",
    description="Click the button to execute the AI team that will research and generate a LaTeX report on Machine Learning for effort estimation."
)

if __name__ == "__main__":
    interface.launch()