Spaces:
Sleeping
Sleeping
File size: 1,750 Bytes
3eeee18 | 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 | from flask import Flask, request, jsonify
from crewai import Agent, Task, Crew
import os
# Your free Groq key
os.environ["GROQ_API_KEY"] = "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"
app = Flask(__name__)
@app.route("/")
def home():
return "🤖 CrewAI Brain Running!"
@app.route("/build-website", methods=["POST"])
def build_website():
data = request.json
niche = data.get("niche", "AI Tools")
# AI Agents Team
planner = Agent(
role="Website Planner",
goal=f"Plan a premium website for {niche}",
backstory="Expert product strategist who plans successful websites",
llm="groq/llama-3.3-70b-versatile"
)
developer = Agent(
role="Web Developer",
goal=f"Build complete HTML/CSS/JS for {niche} website",
backstory="Senior full-stack developer. Expert in premium dark-theme design.",
llm="groq/llama-3.3-70b-versatile"
)
# Tasks
plan_task = Task(
description=f"Plan the structure, sections, and features for a website about: {niche}. List all sections and key features.",
agent=planner
)
build_task = Task(
description=f"Build a COMPLETE website for: {niche}. Use dark theme (#0A0A0F), orange accent (#FF6B00), Bebas Neue font. Include Hero, Features, Tools, FAQ, Contact form. Write REAL content, no Lorem Ipsum. Return complete HTML with CSS in <style> and JS in <script>.",
agent=developer
)
# Run Team
crew = Crew(agents=[planner, developer], tasks=[plan_task, build_task])
result = crew.kickoff()
return jsonify({"success": True, "website": str(result), "niche": niche})
if __name__ == "__main__":
app.run(host="0.0.0.0", port=7860) |