Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from chains.coordinator_chain import coordinator_chain | |
| from chains.frontend_chain import frontend_chain | |
| from chains.backend_chain import backend_chain | |
| from chains.review_chain import review_chain | |
| def ai_pipeline(brief): | |
| if not brief.strip(): | |
| return "Please enter a valid project brief.", "", "", "", "" | |
| # Step 1 β Coordinator Agent | |
| tasks_json = coordinator_chain.run(brief) | |
| # Step 2 β Frontend Agent | |
| frontend_code = frontend_chain.run(tasks_json) | |
| # Step 3 β Backend Agent | |
| backend_code = backend_chain.run(tasks_json) | |
| # Step 4 β Review Agent | |
| review_notes = review_chain.run({ | |
| "tasks": tasks_json, | |
| "frontend": frontend_code, | |
| "backend": backend_code | |
| }) | |
| return tasks_json, frontend_code, backend_code, review_notes | |
| with gr.Blocks(title="AI Project Decomposer") as demo: | |
| gr.Markdown("# π€ AI Project Decomposer (LangChain x HuggingFace)") | |
| gr.Markdown("Enter a project brief β the AI will split it into frontend/backend tasks and generate code!") | |
| brief = gr.Textbox( | |
| lines=6, | |
| label="Project Brief", | |
| placeholder="Example: Build a task management app with authentication and task sharing." | |
| ) | |
| generate_btn = gr.Button("π Generate Technical Plan") | |
| coordinator_out = gr.Code(label="π§ Coordinator (Task Breakdown)", language="json") | |
| frontend_out = gr.Code(label="π¨ Frontend Agent (React Code)", language="javascript") | |
| backend_out = gr.Code(label="βοΈ Backend Agent (API + Schema)", language="python") | |
| review_out = gr.Textbox(label="π Review Agent Feedback", lines=6) | |
| generate_btn.click( | |
| ai_pipeline, | |
| inputs=brief, | |
| outputs=[coordinator_out, frontend_out, backend_out, review_out] | |
| ) | |
| demo.launch() | |