Spaces:
Sleeping
Sleeping
| 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__) | |
| def home(): | |
| return "🤖 CrewAI Brain Running!" | |
| 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) |