Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
from crewai import Agent, Task, Crew, LLM
|
2 |
import gradio as gr
|
3 |
|
4 |
-
def criar_crew():
|
5 |
|
6 |
groq_llm = LLM(model="groq/llama-3.3-70b-versatile")
|
7 |
|
8 |
pesquisador = Agent(
|
9 |
role="Pesquisador",
|
10 |
-
goal="Buscar informações detalhadas sobre
|
11 |
backstory="Um especialista em coleta de dados e análise de informações.",
|
12 |
llm=groq_llm
|
13 |
)
|
@@ -27,9 +27,9 @@ def criar_crew():
|
|
27 |
)
|
28 |
|
29 |
tarefa_pesquisa = Task(
|
30 |
-
description="Pesquise informações detalhadas sobre
|
31 |
agent=pesquisador,
|
32 |
-
expected_output='Informações corretas e detalhadas sobre
|
33 |
)
|
34 |
|
35 |
tarefa_redacao = Task(
|
@@ -39,31 +39,39 @@ def criar_crew():
|
|
39 |
)
|
40 |
|
41 |
tarefa_latex = Task(
|
42 |
-
description="Com base
|
43 |
agent=latex,
|
44 |
expected_output='Um documento Latex'
|
45 |
)
|
46 |
|
47 |
equipe = Crew(
|
48 |
-
agents=[pesquisador, redator],
|
49 |
tasks=[tarefa_pesquisa, tarefa_redacao, tarefa_latex]
|
50 |
)
|
51 |
|
52 |
return equipe
|
53 |
|
54 |
def executar_crew(entrada):
|
55 |
-
equipe = criar_crew()
|
56 |
resultado = equipe.kickoff()
|
57 |
return resultado
|
58 |
|
59 |
# Interface Gradio
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
)
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
if __name__ == "__main__":
|
69 |
interface.launch()
|
|
|
1 |
from crewai import Agent, Task, Crew, LLM
|
2 |
import gradio as gr
|
3 |
|
4 |
+
def criar_crew(tema):
|
5 |
|
6 |
groq_llm = LLM(model="groq/llama-3.3-70b-versatile")
|
7 |
|
8 |
pesquisador = Agent(
|
9 |
role="Pesquisador",
|
10 |
+
goal="Buscar informações detalhadas sobre o assunto informado.",
|
11 |
backstory="Um especialista em coleta de dados e análise de informações.",
|
12 |
llm=groq_llm
|
13 |
)
|
|
|
27 |
)
|
28 |
|
29 |
tarefa_pesquisa = Task(
|
30 |
+
description="Pesquise informações detalhadas sobre {}.".format(tema),
|
31 |
agent=pesquisador,
|
32 |
+
expected_output='Informações corretas e detalhadas sobre o assunto informado'
|
33 |
)
|
34 |
|
35 |
tarefa_redacao = Task(
|
|
|
39 |
)
|
40 |
|
41 |
tarefa_latex = Task(
|
42 |
+
description="Com base no resumo, crie um documento latex.",
|
43 |
agent=latex,
|
44 |
expected_output='Um documento Latex'
|
45 |
)
|
46 |
|
47 |
equipe = Crew(
|
48 |
+
agents=[pesquisador, redator, latex],
|
49 |
tasks=[tarefa_pesquisa, tarefa_redacao, tarefa_latex]
|
50 |
)
|
51 |
|
52 |
return equipe
|
53 |
|
54 |
def executar_crew(entrada):
|
55 |
+
equipe = criar_crew(entrada)
|
56 |
resultado = equipe.kickoff()
|
57 |
return resultado
|
58 |
|
59 |
# Interface Gradio
|
60 |
+
with gr.Blocks() as interface:
|
61 |
+
with gr.Row():
|
62 |
+
with gr.Column():
|
63 |
+
gr.Markdown("# Agentes: Pesquisa e Relatório em Latex")
|
64 |
+
gr.Markdown("Clique no botão para executar a equipe de agentes (três) que irão pesquisar e criar um relatório sobre o assunto informados.")
|
65 |
+
tema_input = gr.Textbox(label="Informe o tema")
|
66 |
+
submit_button = gr.Button(value="Executar")
|
67 |
+
with gr.Column():
|
68 |
+
gr.Image(value="diagrama.png", label="Arquitetura interna dos agentes", width=400)
|
69 |
+
with gr.Row():
|
70 |
+
output_text = gr.Textbox(label="Saída documento no formato Latex", show_copy_button=True)
|
71 |
+
|
72 |
+
submit_button.click(fn=executar_crew,
|
73 |
+
inputs=[tema_input],
|
74 |
+
outputs=output_text)
|
75 |
+
|
76 |
if __name__ == "__main__":
|
77 |
interface.launch()
|