Spaces:
Runtime error
Runtime error
Upload 9 files
Browse files- README.md +5 -4
- app.py +21 -0
- product_manager_agent.py +27 -0
- project_manager_agent.py +28 -0
- quality_assurance_agent.py +44 -0
- requirements.txt +11 -0
- software_architect_agent.py +27 -0
- software_engineer_agent.py +42 -0
- ui_designer_agent.py +42 -0
README.md
CHANGED
@@ -1,13 +1,14 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
emoji: π
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 5.29.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
-
|
|
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: MAC
|
3 |
emoji: π
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: blue
|
6 |
sdk: gradio
|
7 |
sdk_version: 5.29.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
+
license: mit
|
11 |
+
short_description: MAC
|
12 |
---
|
13 |
|
14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from utils.langgraph_pipeline import run_pipeline_and_save
|
3 |
+
|
4 |
+
def handle_run(prompt):
|
5 |
+
chat_log, zip_path = run_pipeline_and_save(prompt)
|
6 |
+
return chat_log, zip_path
|
7 |
+
|
8 |
+
with gr.Blocks() as demo:
|
9 |
+
gr.Markdown("# π§ Multi-Agent UI Generator")
|
10 |
+
input_box = gr.Textbox(lines=4, label="Enter your product idea prompt")
|
11 |
+
run_btn = gr.Button("Generate Website")
|
12 |
+
chatbox = gr.Chatbot(label="Agent Conversation Log", type="messages")
|
13 |
+
file_output = gr.File(label="Download UI ZIP")
|
14 |
+
|
15 |
+
run_btn.click(
|
16 |
+
fn=handle_run,
|
17 |
+
inputs=[input_box],
|
18 |
+
outputs=[chatbox, file_output],
|
19 |
+
)
|
20 |
+
|
21 |
+
demo.launch()
|
product_manager_agent.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
+
import torch
|
3 |
+
from langchain_core.messages import AIMessage
|
4 |
+
|
5 |
+
MODEL_REPO = "Rahul-8799/product_manager_mistral"
|
6 |
+
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_REPO, trust_remote_code=True)
|
8 |
+
model = AutoModelForCausalLM.from_pretrained(
|
9 |
+
MODEL_REPO,
|
10 |
+
torch_dtype=torch.float16,
|
11 |
+
device_map="auto"
|
12 |
+
)
|
13 |
+
|
14 |
+
def run(state: dict) -> dict:
|
15 |
+
"""Generates structured product requirements from user input prompt."""
|
16 |
+
messages = state["messages"]
|
17 |
+
prompt = messages[-1].content
|
18 |
+
|
19 |
+
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(model.device)
|
20 |
+
output_ids = model.generate(input_ids, max_new_tokens=3000)
|
21 |
+
output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
22 |
+
|
23 |
+
return {
|
24 |
+
"messages": [AIMessage(content=output)],
|
25 |
+
"chat_log": state["chat_log"] + [{"role": "Product Manager", "content": output}],
|
26 |
+
"pm_output": output,
|
27 |
+
}
|
project_manager_agent.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
+
import torch
|
3 |
+
from langchain_core.messages import AIMessage
|
4 |
+
|
5 |
+
MODEL_REPO = "Rahul-8799/project_manager_gemma3"
|
6 |
+
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_REPO, trust_remote_code=True)
|
8 |
+
model = AutoModelForCausalLM.from_pretrained(
|
9 |
+
MODEL_REPO,
|
10 |
+
torch_dtype=torch.float16,
|
11 |
+
device_map="auto"
|
12 |
+
)
|
13 |
+
|
14 |
+
|
15 |
+
def run(state: dict) -> dict:
|
16 |
+
"""Creates project plan based on product requirements."""
|
17 |
+
messages = state["messages"]
|
18 |
+
prompt = messages[-1].content
|
19 |
+
|
20 |
+
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(model.device)
|
21 |
+
output_ids = model.generate(input_ids, max_new_tokens=3000)
|
22 |
+
output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
23 |
+
|
24 |
+
return {
|
25 |
+
"messages": [AIMessage(content=output)],
|
26 |
+
"chat_log": state["chat_log"] + [{"role": "Project Manager", "content": output}],
|
27 |
+
"proj_output": output,
|
28 |
+
}
|
quality_assurance_agent.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
+
import torch
|
3 |
+
from langchain_core.messages import AIMessage
|
4 |
+
|
5 |
+
MODEL_REPO = "Rahul-8799/quality_assurance_stablecode"
|
6 |
+
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_REPO, trust_remote_code=True)
|
8 |
+
model = AutoModelForCausalLM.from_pretrained(
|
9 |
+
MODEL_REPO,
|
10 |
+
torch_dtype=torch.float16,
|
11 |
+
device_map="auto"
|
12 |
+
)
|
13 |
+
|
14 |
+
def run(state: dict) -> dict:
|
15 |
+
"""Reviews UI/UX implementation and suggests improvements for better user experience"""
|
16 |
+
messages = state["messages"]
|
17 |
+
prompt = messages[-1].content
|
18 |
+
|
19 |
+
# Enhance the prompt with UI/UX quality checks
|
20 |
+
enhanced_prompt = f"""
|
21 |
+
Review the UI implementation and check for:
|
22 |
+
1. Proper spacing and alignment
|
23 |
+
2. Consistent styling and theming
|
24 |
+
3. Responsive design implementation
|
25 |
+
4. Accessibility compliance
|
26 |
+
5. Visual hierarchy
|
27 |
+
6. Component reusability
|
28 |
+
7. Performance optimization
|
29 |
+
8. Cross-browser compatibility
|
30 |
+
9. Mobile responsiveness
|
31 |
+
10. User interaction patterns
|
32 |
+
|
33 |
+
Original code: {prompt}
|
34 |
+
"""
|
35 |
+
|
36 |
+
input_ids = tokenizer(enhanced_prompt, return_tensors="pt").input_ids.to(model.device)
|
37 |
+
output_ids = model.generate(input_ids, max_new_tokens=3000)
|
38 |
+
output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
39 |
+
|
40 |
+
return {
|
41 |
+
"messages": [AIMessage(content=output)],
|
42 |
+
"chat_log": state["chat_log"] + [{"role": "Quality Assurance", "content": output}],
|
43 |
+
"qa_output": output,
|
44 |
+
}
|
requirements.txt
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
transformers>=4.38.0
|
2 |
+
torch
|
3 |
+
langgraph>=0.0.35
|
4 |
+
langchain
|
5 |
+
gradio
|
6 |
+
peft
|
7 |
+
huggingface_hub
|
8 |
+
bitsandbytes
|
9 |
+
accelerate
|
10 |
+
sentencepiece
|
11 |
+
protobuf
|
software_architect_agent.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
+
import torch
|
3 |
+
from langchain_core.messages import AIMessage
|
4 |
+
|
5 |
+
MODEL_REPO = "Rahul-8799/software_architect_command_r"
|
6 |
+
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_REPO, trust_remote_code=True)
|
8 |
+
model = AutoModelForCausalLM.from_pretrained(
|
9 |
+
MODEL_REPO,
|
10 |
+
torch_dtype=torch.float16,
|
11 |
+
device_map="auto"
|
12 |
+
)
|
13 |
+
|
14 |
+
def run(state: dict) -> dict:
|
15 |
+
"""Software Architect designs overall system architecture"""
|
16 |
+
messages = state["messages"]
|
17 |
+
prompt = messages[-1].content
|
18 |
+
|
19 |
+
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(model.device)
|
20 |
+
output_ids = model.generate(input_ids, max_new_tokens=3000)
|
21 |
+
output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
22 |
+
|
23 |
+
return {
|
24 |
+
"messages": [AIMessage(content=output)],
|
25 |
+
"chat_log": state["chat_log"] + [{"role": "Software Architect", "content": output}],
|
26 |
+
"arch_output": output,
|
27 |
+
}
|
software_engineer_agent.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
+
import torch
|
3 |
+
from langchain_core.messages import AIMessage
|
4 |
+
|
5 |
+
MODEL_REPO = "Rahul-8799/software_engineer_mellum"
|
6 |
+
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_REPO, trust_remote_code=True)
|
8 |
+
model = AutoModelForCausalLM.from_pretrained(
|
9 |
+
MODEL_REPO,
|
10 |
+
torch_dtype=torch.float16,
|
11 |
+
device_map="auto"
|
12 |
+
)
|
13 |
+
|
14 |
+
def run(state: dict) -> dict:
|
15 |
+
"""Software Engineer generates clean, modern UI code using best practices"""
|
16 |
+
messages = state["messages"]
|
17 |
+
prompt = messages[-1].content
|
18 |
+
|
19 |
+
# Enhance the prompt with UI implementation guidelines
|
20 |
+
enhanced_prompt = f"""
|
21 |
+
Generate modern, clean UI code following these guidelines:
|
22 |
+
1. Use Tailwind CSS for styling (recommended for consistent spacing and responsive design)
|
23 |
+
2. Implement proper semantic HTML structure
|
24 |
+
3. Use CSS Grid and Flexbox for layouts
|
25 |
+
4. Add proper ARIA labels for accessibility
|
26 |
+
5. Implement responsive breakpoints
|
27 |
+
6. Use CSS variables for consistent theming
|
28 |
+
7. Add proper error handling and loading states
|
29 |
+
8. Implement proper component structure
|
30 |
+
|
31 |
+
Original requirements: {prompt}
|
32 |
+
"""
|
33 |
+
|
34 |
+
input_ids = tokenizer(enhanced_prompt, return_tensors="pt").input_ids.to(model.device)
|
35 |
+
output_ids = model.generate(input_ids, max_new_tokens=3000)
|
36 |
+
output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
37 |
+
|
38 |
+
return {
|
39 |
+
"messages": [AIMessage(content=output)],
|
40 |
+
"chat_log": state["chat_log"] + [{"role": "Software Engineer", "content": output}],
|
41 |
+
"dev_output": output,
|
42 |
+
}
|
ui_designer_agent.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
+
import torch
|
3 |
+
from langchain_core.messages import AIMessage
|
4 |
+
|
5 |
+
MODEL_REPO = "Rahul-8799/ui_designer_mistral" # You'll need to fine-tune this model
|
6 |
+
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_REPO, trust_remote_code=True)
|
8 |
+
model = AutoModelForCausalLM.from_pretrained(
|
9 |
+
MODEL_REPO,
|
10 |
+
torch_dtype=torch.float16,
|
11 |
+
device_map="auto"
|
12 |
+
)
|
13 |
+
|
14 |
+
def run(state: dict) -> dict:
|
15 |
+
"""UI Designer creates beautiful and structured UI designs with proper spacing and layout"""
|
16 |
+
messages = state["messages"]
|
17 |
+
prompt = messages[-1].content
|
18 |
+
|
19 |
+
# Enhance the prompt with UI design principles
|
20 |
+
enhanced_prompt = f"""
|
21 |
+
Create a beautiful and well-structured UI design following these principles:
|
22 |
+
1. Use proper spacing and padding (recommended: 1rem/16px for padding, 2rem/32px for margins)
|
23 |
+
2. Implement a consistent color scheme
|
24 |
+
3. Ensure proper hierarchy with clear headings
|
25 |
+
4. Use responsive design principles
|
26 |
+
5. Implement proper grid system
|
27 |
+
6. Add smooth transitions and hover effects
|
28 |
+
7. Ensure proper contrast and readability
|
29 |
+
8. Use modern UI components and patterns
|
30 |
+
|
31 |
+
Original requirements: {prompt}
|
32 |
+
"""
|
33 |
+
|
34 |
+
input_ids = tokenizer(enhanced_prompt, return_tensors="pt").input_ids.to(model.device)
|
35 |
+
output_ids = model.generate(input_ids, max_new_tokens=3000)
|
36 |
+
output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
37 |
+
|
38 |
+
return {
|
39 |
+
"messages": [AIMessage(content=output)],
|
40 |
+
"chat_log": state["chat_log"] + [{"role": "UI Designer", "content": output}],
|
41 |
+
"ui_design_output": output,
|
42 |
+
}
|