faizee07 commited on
Commit
961bf3c
·
verified ·
1 Parent(s): e656d60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -1,8 +1,8 @@
1
  import os
2
  import gradio as gr
3
  from crewai import Agent, Task, Crew, Process
4
- # CORRECTED IMPORTS FOR NEWER VERSIONS
5
- from crewai_tools import DuckDuckGoSearchRun, FileWriterTool
6
  # ---
7
  from langchain_google_genai import ChatGoogleGenerativeAI
8
 
@@ -20,9 +20,11 @@ except Exception as e:
20
  llm = None
21
 
22
  # --- 2. DEFINE TOOLS AND OUTPUT DIRECTORY ---
23
- search_tool = DuckDuckGoSearchRun()
 
 
24
  os.makedirs("outputs", exist_ok=True)
25
- file_write_tool = FileWriterTool(file_path="outputs/index.html")
26
 
27
  # --- 3. DEFINE THE AGENT TEAM ---
28
  designer = Agent(
@@ -63,7 +65,7 @@ developer = Agent(
63
  design_task = Task(
64
  description=(
65
  "Analyze the user's prompt: '{prompt}' to understand the desired vibe. "
66
- "Conduct a web search for inspiration on color palettes, font pairings, and overall aesthetics. "
67
  "Create a comprehensive 'Design Brief' document with a color palette (hex codes), font pairing (Google Fonts), and a detailed page structure."
68
  ),
69
  expected_output=(
@@ -86,7 +88,7 @@ development_task = Task(
86
  description=(
87
  "Based on the Design Brief and Content Map, create a single-file HTML website. "
88
  "The file must be self-contained with embedded CSS and any simple JavaScript. "
89
- "Use the specified colors and Google Fonts. Your final output MUST be only the code for the HTML file."
90
  ),
91
  expected_output=(
92
  "The complete HTML code for the website, written to 'outputs/index.html'."
 
1
  import os
2
  import gradio as gr
3
  from crewai import Agent, Task, Crew, Process
4
+ # CORRECTED IMPORTS FOR LATEST VERSIONS
5
+ from crewai_tools import SerperDevTool, FileWriterTool
6
  # ---
7
  from langchain_google_genai import ChatGoogleGenerativeAI
8
 
 
20
  llm = None
21
 
22
  # --- 2. DEFINE TOOLS AND OUTPUT DIRECTORY ---
23
+ # Using SerperDevTool for web search (you'll need SERPER_API_KEY in your environment)
24
+ # Alternatively, you can remove the search tool if you don't have the API key
25
+ search_tool = SerperDevTool()
26
  os.makedirs("outputs", exist_ok=True)
27
+ file_write_tool = FileWriterTool()
28
 
29
  # --- 3. DEFINE THE AGENT TEAM ---
30
  designer = Agent(
 
65
  design_task = Task(
66
  description=(
67
  "Analyze the user's prompt: '{prompt}' to understand the desired vibe. "
68
+ "Research inspiration on color palettes, font pairings, and overall aesthetics. "
69
  "Create a comprehensive 'Design Brief' document with a color palette (hex codes), font pairing (Google Fonts), and a detailed page structure."
70
  ),
71
  expected_output=(
 
88
  description=(
89
  "Based on the Design Brief and Content Map, create a single-file HTML website. "
90
  "The file must be self-contained with embedded CSS and any simple JavaScript. "
91
+ "Use the specified colors and Google Fonts. Save the HTML to 'outputs/index.html' using the FileWriterTool."
92
  ),
93
  expected_output=(
94
  "The complete HTML code for the website, written to 'outputs/index.html'."