CalSync โ€” Automate Outlook Calendar Colors

Auto-color-code events for your team using rules. Faster visibility, less admin. 10-user minimum ยท 12-month term.

CalSync Colors is a service by CPI Consulting

In this blog post, weโ€™ll show you how to Build a Blazor .NET App that Recognizes Images with OpenAI.

Youโ€™ll see how we securely upload image files, send them to OpenAIโ€™s API, and return a natural-language responseโ€”seamlessly integrated into a modern web interface. This example highlights how CPI Consulting applies advanced AI to solve real-world business challenges through scalable, production-ready .NET solutions.

At CPI Consulting, we specialize in building modern .NET applications integrated with cutting-edge AI. In this post, weโ€™ll walk through how our internal Blazor Server app uses OpenAIโ€™s new GPT-4o model to describe image contentโ€”demonstrating what’s possible when AI meets enterprise-grade development.

This solution uploads an image, sends it to OpenAI, and returns a natural-language description of whatโ€™s insideโ€”all from a user-friendly web interface.

To see this application in action watch the YouTube video of this post, Building a Blazor .NET App that Recognizes Images with OpenAI.

๐Ÿง  How It Works

  1. A user selects an image in the Blazor UI.
  2. The C# code uploads the image to OpenAI using the API.
  3. A GPT-4o model processes the image and returns descriptive text.
  4. The Blazor app displays the result.

This is powered by OpenAIโ€™s multimodal capabilityโ€”GPT-4o can interpret both text and images together in one context window.

๐Ÿ”ง Key Components and Code

File Upload to OpenAI

To handle file uploads, we use OpenAIโ€™s official .NET SDK and wrap it in a reusable service. The snippet below shows how a file stream is uploaded using the Vision-specific FileUploadPurpose.

We make sure to validate the file before uploading and catch exceptions for resilience in production scenarios.

Sending Image to GPT-4o

After uploading, the image is passed to the GPT-4o model using OpenAIResponseClient. We combine both text and image inputs into the same request:

The model responds with structured content:

๐Ÿ’ก Blazor Integration

On the frontend, we use InputFile to handle user uploads. The selected image is streamed directly into memory and passed to the backend service:

This approach keeps the app lightweight, scalable, and secure. Below you can see the Blazor interface.

Once uploading an image OpenAI gpt-4o retunrs the object description

๐ŸŒ Use Cases

  • Retail & eCommerce: Automated product tagging.
  • Security & Compliance: Flagging restricted content in uploads.
  • Accessibility: Generating alt-text for screen readers.
  • Legal: Describing evidence or document images.

Letโ€™s Build It Together

Need to add vision capabilities to your .NET applications? Contact CPI Consulting and letโ€™s build something powerful.

Please enable JavaScript in your browser to complete this form.
Name

Discover more from CPI Consulting -Specialist Azure Consultancy

Subscribe to get the latest posts sent to your email.