UiExplain is a Blazor-based web application designed to analyze user interface (UI) screenshots using advanced AI models. The app allows users to upload images of UI designs, which are then processed through a two-stage AI pipeline:
The application consists of two main projects:
Built with .NET 9, the app emphasizes production-ready practices such as input validation, error handling, logging, and responsive design using Bootstrap.
UiExplain.Api\appsettings.json:
HuggingFaceApiKeyGroqApiKey
NOTE: Could be provided in a direct chat if required/explain page.This document outlines how I used AI (specifically GitHub Copilot in Visual Studio and Grok Code Fast as an agent) to build the UiExplain application, a Blazor-based UI analysis tool that leverages AI for image captioning and UX insights. The app consists of a Blazor Web App (UiExplain.Web) and an ASP.NET Core API (UiExplain.Api), targeting .NET 9.
Prompt: "Configure the solution so the Web project can call the API project locally."
Result: Added CORS to API, configured HttpClient in Web with base address, updated WeatherForecastService to call API instead of mock data. Enabled local communication between projects.
Prompt: "Create the following pages in UiExplain.Web: • Explain UI page ("/explain") add to the menu"
Result: Created Explain.razor page with upload card and result panel, added to NavMenu with icon. Integrated Bootstrap for responsive design.
Prompt: "In UiExplain.Api, create a clean structure with: • Controllers • Services • Models Add an ExplainUiController with a POST endpoint that accepts an image. The controller should delegate logic to a service. Create an interface-based service for explaining a UI screenshot. The service should: • Accept an image stream • Return a structured response model"
Result: Established Controllers/Services/Models folders, created ExplainUiController with POST endpoint, IExplainUiService interface, and ExplainUiService implementation with mock logic.
Prompt: "Implement IImageCaptionService using Hugging Face Inference API. Requirements: - Use the model "Salesforce/blip-image-captioning-base" - Use HttpClient - Send the image as raw bytes - Extract the generated_text from the response JSON - Handle basic HTTP errors"
Result: Implemented ImageCaptionService with HttpClient calls to Hugging Face, base64 encoding, response parsing, and error handling. Updated orchestrator to use it.
Prompt: "Create an interface named IUiAnalysisService. It should: - Accept a UI caption string - Return an ExplainUiResponse Implement IUiAnalysisService using the Groq OpenAI-compatible API. Requirements: - Endpoint: https://api.groq.com/openai/v1/chat/completions - Model: llama-3.1-8b-instant - Temperature: 0.2 - Send a system message establishing UX and accessibility expertise - Send a user prompt that requests JSON ONLY output - Deserialize the model response into ExplainResult"
Result: Created IUiAnalysisService and UiAnalysisService with Groq API integration, JSON prompting, and deserialization. Integrated into orchestrator for full AI pipeline.
Prompt: "Please rename ExplainUiService to UiExplainOrchestrator Update ExplainUiController so that: - It accepts an image via multipart/form-data - It calls UiExplainOrchestrator - It returns ExplainResult - It validates image size and type"
Result: Renamed service, added validation (size/type checks), updated controller to use orchestrator. Ensured production-ready input handling.
Prompt: "pleasea add structured logging around where it nice to have, eg.: - Vision caption output - LLM request/response timing - Errors from external AI services"
Result: Added ILogger injections and structured logs for AI requests/responses, timings, and errors across services and orchestrator.
Prompt: "let pretify Result Panel. make it stylish for h6 as a parent and their child."
Result: Enhanced ResultPanel with Bootstrap icons, colors (success/warning/info), and spacing for better visual hierarchy.
Prompt: "update home page content describe what application do and how does it work do it stylish"
Result: Redesigned Home.razor with hero section, feature cards, and workflow explanation using Bootstrap for responsive, professional styling.
Prompt: "Create an AdminLayout.razor that is different from MainLayout. It should include: • A side navigation menu • A header with "Admin Area" • A content section Then create Admin page ("/Admin") within AdminLayout applied Implement the Admin page using in-memory fake data. Show previous explanation summaries in a card list. No database required."
Result: Created AdminLayout with sidebar/header, Admin.razor page with fake summaries in cards, added to navigation.
Prompt: "Review the solution and suggest: - SSR-specific best practices - Performance improvements - Common pitfalls to avoid Please suggest improvements with variants or questions. I will select prefered" followed by "please do all you sugested with keep the implementation minimal and production-oriented."
Result: Implemented client-side validation, HttpClient timeouts, stream-safe handling, LLM JSON cleanup, and error resilience across Web and API. Ensured minimal, production-ready code.
SCREENSHOTS:
UiExplain is a Blazor-based web application designed to analyze user interface (UI) screenshots using advanced AI models. The app allows users to upload images of UI designs, which are then processed through a two-stage AI pipeline:
The application consists of two main projects:
Built with .NET 9, the app emphasizes production-ready practices such as input validation, error handling, logging, and responsive design using Bootstrap.
UiExplain.Api\appsettings.json:
HuggingFaceApiKeyGroqApiKey
NOTE: Could be provided in a direct chat if required/explain page.This document outlines how I used AI (specifically GitHub Copilot in Visual Studio and Grok Code Fast as an agent) to build the UiExplain application, a Blazor-based UI analysis tool that leverages AI for image captioning and UX insights. The app consists of a Blazor Web App (UiExplain.Web) and an ASP.NET Core API (UiExplain.Api), targeting .NET 9.
Prompt: "Configure the solution so the Web project can call the API project locally."
Result: Added CORS to API, configured HttpClient in Web with base address, updated WeatherForecastService to call API instead of mock data. Enabled local communication between projects.
Prompt: "Create the following pages in UiExplain.Web: • Explain UI page ("/explain") add to the menu"
Result: Created Explain.razor page with upload card and result panel, added to NavMenu with icon. Integrated Bootstrap for responsive design.
Prompt: "In UiExplain.Api, create a clean structure with: • Controllers • Services • Models Add an ExplainUiController with a POST endpoint that accepts an image. The controller should delegate logic to a service. Create an interface-based service for explaining a UI screenshot. The service should: • Accept an image stream • Return a structured response model"
Result: Established Controllers/Services/Models folders, created ExplainUiController with POST endpoint, IExplainUiService interface, and ExplainUiService implementation with mock logic.
Prompt: "Implement IImageCaptionService using Hugging Face Inference API. Requirements: - Use the model "Salesforce/blip-image-captioning-base" - Use HttpClient - Send the image as raw bytes - Extract the generated_text from the response JSON - Handle basic HTTP errors"
Result: Implemented ImageCaptionService with HttpClient calls to Hugging Face, base64 encoding, response parsing, and error handling. Updated orchestrator to use it.
Prompt: "Create an interface named IUiAnalysisService. It should: - Accept a UI caption string - Return an ExplainUiResponse Implement IUiAnalysisService using the Groq OpenAI-compatible API. Requirements: - Endpoint: https://api.groq.com/openai/v1/chat/completions - Model: llama-3.1-8b-instant - Temperature: 0.2 - Send a system message establishing UX and accessibility expertise - Send a user prompt that requests JSON ONLY output - Deserialize the model response into ExplainResult"
Result: Created IUiAnalysisService and UiAnalysisService with Groq API integration, JSON prompting, and deserialization. Integrated into orchestrator for full AI pipeline.
Prompt: "Please rename ExplainUiService to UiExplainOrchestrator Update ExplainUiController so that: - It accepts an image via multipart/form-data - It calls UiExplainOrchestrator - It returns ExplainResult - It validates image size and type"
Result: Renamed service, added validation (size/type checks), updated controller to use orchestrator. Ensured production-ready input handling.
Prompt: "pleasea add structured logging around where it nice to have, eg.: - Vision caption output - LLM request/response timing - Errors from external AI services"
Result: Added ILogger injections and structured logs for AI requests/responses, timings, and errors across services and orchestrator.
Prompt: "let pretify Result Panel. make it stylish for h6 as a parent and their child."
Result: Enhanced ResultPanel with Bootstrap icons, colors (success/warning/info), and spacing for better visual hierarchy.
Prompt: "update home page content describe what application do and how does it work do it stylish"
Result: Redesigned Home.razor with hero section, feature cards, and workflow explanation using Bootstrap for responsive, professional styling.
Prompt: "Create an AdminLayout.razor that is different from MainLayout. It should include: • A side navigation menu • A header with "Admin Area" • A content section Then create Admin page ("/Admin") within AdminLayout applied Implement the Admin page using in-memory fake data. Show previous explanation summaries in a card list. No database required."
Result: Created AdminLayout with sidebar/header, Admin.razor page with fake summaries in cards, added to navigation.
Prompt: "Review the solution and suggest: - SSR-specific best practices - Performance improvements - Common pitfalls to avoid Please suggest improvements with variants or questions. I will select prefered" followed by "please do all you sugested with keep the implementation minimal and production-oriented."
Result: Implemented client-side validation, HttpClient timeouts, stream-safe handling, LLM JSON cleanup, and error resilience across Web and API. Ensured minimal, production-ready code.
SCREENSHOTS: