import gradio as gr import json class ProjectScopingTool: """ Handles project scoping by collecting key details such as type, domain, budget, and timeline. """ def __init__(self): self.project_details = { "type": None, "domain": None, "technical_requirements": {}, "budget_range": {}, "timeline": {} } def collect_project_details(self, project_type, domain, budget_min, budget_max, timeline_months): """ Collects and structures project details from user input. """ self.project_details = { "type": project_type, "domain": domain, "budget_range": {"min": budget_min, "max": budget_max}, "timeline": {"months": timeline_months} } return json.dumps(self.project_details, indent=2) class TechnicalArchitectureTool: """ Determines the appropriate technical architecture based on the project type. """ def generate_architecture(self, project_type): architectures = { "web": { "frontend": ["React", "Next.js", "Tailwind"], "backend": ["FastAPI", "Django", "Express"], "database": ["PostgreSQL", "MongoDB"] }, "blockchain": { "blockchain_type": "EVM-compatible", "smart_contract_language": "Solidity", "consensus_mechanism": "Proof of Stake" }, "ai": { "model_type": "Transformer", "inference_strategy": "Cloud-based", "data_processing": "Distributed" } } return json.dumps(architectures.get(project_type, "Invalid project type"), indent=2) class CostEstimationTool: """ Estimates the cost based on the architecture complexity and timeline. """ def estimate_project_cost(self, architecture_size, timeline_months): base_costs = { "development": 5000 * (architecture_size * 0.5), "infrastructure": 500 * (architecture_size * 0.3), "maintenance": 1000 * (architecture_size * 0.2) } total_cost = sum(base_costs.values()) return json.dumps({"total_estimated_cost": total_cost, "breakdown": base_costs}, indent=2) class DeploymentTool: """ Suggests a deployment strategy based on best practices. """ def generate_deployment_strategy(self): return json.dumps({ "container_strategy": "Docker + Kubernetes", "cloud_provider": "AWS", "services": ["ECS", "Lambda", "S3", "RDS"], "ci_cd_pipeline": "GitHub Actions" }, indent=2) class MeetingPreparationTool: """ Provides meeting agendas depending on the project stage. """ def generate_meeting_agenda(self, project_stage): agendas = { "initial_discovery": [ "Project Vision Validation", "Technical Feasibility Discussion", "Initial Scope Definition" ], "architecture_review": [ "Technical Architecture Walkthrough", "Technology Stack Validation", "Performance Considerations" ] } return json.dumps(agendas.get(project_stage, "No agenda found for this stage"), indent=2) # Instantiate tools scoping_tool = ProjectScopingTool() tech_arch_tool = TechnicalArchitectureTool() cost_tool = CostEstimationTool() deploy_tool = DeploymentTool() meeting_tool = MeetingPreparationTool() # Define Gradio Interface with gr.Blocks() as demo: gr.Markdown("# 🏗️ Project Scoping & Cost Estimation Tool") with gr.Row(): project_type = gr.Dropdown(["web", "blockchain", "ai"], label="Select Project Type") domain = gr.Textbox(label="Enter Project Domain") with gr.Row(): budget_min = gr.Number(label="Min Budget ($)") budget_max = gr.Number(label="Max Budget ($)") timeline_months = gr.Number(label="Timeline (Months)") project_output = gr.Textbox(label="Project Details", interactive=False) arch_output = gr.Textbox(label="Technical Architecture", interactive=False) cost_output = gr.Textbox(label="Estimated Cost", interactive=False) deploy_output = gr.Textbox(label="Deployment Strategy", interactive=False) meeting_output = gr.Textbox(label="Meeting Agenda", interactive=False) def process_inputs(p_type, dom, min_b, max_b, months): project_details = scoping_tool.collect_project_details(p_type, dom, min_b, max_b, months) architecture = tech_arch_tool.generate_architecture(p_type) estimated_cost = cost_tool.estimate_project_cost(len(architecture), months) deployment_strategy = deploy_tool.generate_deployment_strategy() meeting_agenda = meeting_tool.generate_meeting_agenda("initial_discovery") return project_details, architecture, estimated_cost, deployment_strategy, meeting_agenda process_button = gr.Button("Generate Estimates") process_button.click(process_inputs, inputs=[project_type, domain, budget_min, budget_max, timeline_months], outputs=[project_output, arch_output, cost_output, deploy_output, meeting_output]) # Launch the Gradio App demo.launch(share=True)