Spaces:
Running
Running
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() | |