Docfile commited on
Commit
6152aba
·
verified ·
1 Parent(s): 78f155b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -11
app.py CHANGED
@@ -27,15 +27,17 @@ class PlanGeneratorAgent(Agent):
27
  def __init__(self):
28
  super().__init__(
29
  name="PlanGenerator",
30
- description="Generates a detailed plan for a presentation.",
 
 
 
 
31
  llm=llm,
32
  tools=[serper_tool]
33
  )
34
 
35
  def run(self, theme):
36
- # Use serper_tool to research
37
  research = serper_tool.search(query=f"Best practices for {theme} presentations")
38
- # Generate plan based on research
39
  plan = "Introduction\nMain Points\nConclusion"
40
  return plan
41
 
@@ -44,12 +46,15 @@ class ContentGeneratorAgent(Agent):
44
  def __init__(self):
45
  super().__init__(
46
  name="ContentGenerator",
47
- description="Generates content for a specific section of a presentation.",
 
 
 
 
48
  llm=llm
49
  )
50
 
51
  def run(self, section, theme):
52
- # Generate content logic
53
  prompt = f"Generate {section} for a presentation on {theme}."
54
  content = self.llm.generate(prompt)
55
  return content
@@ -59,12 +64,15 @@ class PDFCompilerAgent(Agent):
59
  def __init__(self):
60
  super().__init__(
61
  name="PDFCompiler",
62
- description="Compiles presentation content into a PDF.",
 
 
 
 
63
  llm=llm
64
  )
65
 
66
  def run(self, content_dict):
67
- # Compile PDF logic
68
  pdf = FPDF()
69
  pdf.add_page()
70
  pdf.set_font("Arial", size=12)
@@ -88,25 +96,22 @@ class PresentationCrew(Crew):
88
 
89
  def run(self, theme):
90
  try:
91
- # Generate plan
92
  plan = self.delegate("Generate a detailed plan for the presentation on {}".format(theme))
93
  sections = plan.split("\n")
94
  content_dict = {}
95
 
96
- # Generate content for each section
97
  for section in sections:
98
  if section:
99
  content = self.delegate("Generate content for the presentation section: {}".format(section), theme=theme)
100
  content_dict[section] = content
101
 
102
- # Compile PDF
103
  pdf_path = self.delegate("Compile the following content into a PDF: {}".format(content_dict))
104
  return pdf_path
105
  except Exception as e:
106
  print(f"An error occurred: {e}")
107
  return None
108
 
109
- # Streamlit App
110
  def get_pdf_download_link(pdf_path):
111
  with open(pdf_path, "rb") as f:
112
  pdf_bytes = f.read()
 
27
  def __init__(self):
28
  super().__init__(
29
  name="PlanGenerator",
30
+ role="Presentation Planner",
31
+ goal="Create detailed and well-structured presentation outlines",
32
+ backstory="""You are an experienced presentation strategist who excels at
33
+ creating logical and impactful presentation structures. You understand how
34
+ to organize information for maximum audience engagement.""",
35
  llm=llm,
36
  tools=[serper_tool]
37
  )
38
 
39
  def run(self, theme):
 
40
  research = serper_tool.search(query=f"Best practices for {theme} presentations")
 
41
  plan = "Introduction\nMain Points\nConclusion"
42
  return plan
43
 
 
46
  def __init__(self):
47
  super().__init__(
48
  name="ContentGenerator",
49
+ role="Content Creator",
50
+ goal="Generate engaging and informative presentation content",
51
+ backstory="""You are a creative content specialist with expertise in
52
+ transforming ideas into compelling presentation material. You know how
53
+ to balance information with engagement.""",
54
  llm=llm
55
  )
56
 
57
  def run(self, section, theme):
 
58
  prompt = f"Generate {section} for a presentation on {theme}."
59
  content = self.llm.generate(prompt)
60
  return content
 
64
  def __init__(self):
65
  super().__init__(
66
  name="PDFCompiler",
67
+ role="Document Formatter",
68
+ goal="Create professional and well-formatted PDF presentations",
69
+ backstory="""You are a document formatting expert who knows how to
70
+ transform content into visually appealing and professional PDFs. You
71
+ understand typography, layout, and document structure.""",
72
  llm=llm
73
  )
74
 
75
  def run(self, content_dict):
 
76
  pdf = FPDF()
77
  pdf.add_page()
78
  pdf.set_font("Arial", size=12)
 
96
 
97
  def run(self, theme):
98
  try:
 
99
  plan = self.delegate("Generate a detailed plan for the presentation on {}".format(theme))
100
  sections = plan.split("\n")
101
  content_dict = {}
102
 
 
103
  for section in sections:
104
  if section:
105
  content = self.delegate("Generate content for the presentation section: {}".format(section), theme=theme)
106
  content_dict[section] = content
107
 
 
108
  pdf_path = self.delegate("Compile the following content into a PDF: {}".format(content_dict))
109
  return pdf_path
110
  except Exception as e:
111
  print(f"An error occurred: {e}")
112
  return None
113
 
114
+ # Streamlit App Functions
115
  def get_pdf_download_link(pdf_path):
116
  with open(pdf_path, "rb") as f:
117
  pdf_bytes = f.read()