from transformers import AutoTokenizer, AutoModelForCausalLM import torch from langchain_core.messages import AIMessage MODEL_REPO = "Rahul-8799/software_engineer_mellum" tokenizer = AutoTokenizer.from_pretrained(MODEL_REPO, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained( MODEL_REPO, torch_dtype=torch.float16, device_map="auto" ) def run(state: dict) -> dict: """Software Engineer generates clean, modern UI code using best practices""" messages = state["messages"] prompt = messages[-1].content # Enhance the prompt with UI implementation guidelines enhanced_prompt = f""" Objective Generate modern, responsive, and accessible UI code that is visually appealing and adheres to current frontend development best practices. 1. Styling Framework: Tailwind CSS • Use Tailwind CSS utility classes for styling all elements. • Apply spacing, typography, sizing, and layout using Tailwind classes. • Follow a mobile-first design approach. • Use Tailwind’s built-in responsive breakpoints (sm, md, lg, xl, 2xl) to adapt layouts for different screen sizes. 2. Layout Techniques • Use CSS Grid for complex, multi-column or two-dimensional layouts. • Use Flexbox for flexible alignment of components like navigation bars, cards, buttons, and modals. • Maintain consistent spacing with utility classes such as gap, space-x, space-y, p-*, and m-*. 3. Semantic HTML • Use semantic HTML tags appropriately:
,