Skip to content

HuggingFace MCP - Image Generation samples #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

elbruno
Copy link

@elbruno elbruno commented Jul 22, 2025

This pull request introduces a new feature for generating AI images using the Hugging Face MCP Server in C#. It includes updates to the repository's structure, documentation, and the addition of sample solutions, including console applications and a .NET Aspire Blazor WebApp. Additionally, it incorporates service defaults for resilience, health checks, and OpenTelemetry instrumentation. Below is a breakdown of the most important changes:

Documentation Updates:

  • README.md: Added a new entry for the Hugging Face GenImages sample, describing its functionality and linking to the relevant folder.
  • huggingface-genimages/README.md: Comprehensive documentation for the Hugging Face MCP Server samples, including an overview, prerequisites, sample solutions, setup instructions, and usage examples.

Sample Solutions:

  • Console Applications: Two sample console apps (MCP-01-HuggingFace and MCP-02-HuggingFace-Ollama) demonstrate connecting to the Hugging Face MCP Server, listing tools, and generating images from text prompts using cloud-hosted or local models.
  • Blazor WebApp: Introduced a modern web application (HFMCP.GenImage.Web) for AI-powered image generation with a user-friendly interface and extensible architecture. Includes setup instructions and supported models.

Infrastructure Enhancements:

  • Service Defaults: Added a shared project (HFMCP.GenImage.ServiceDefaults) to provide common services such as resilience, health checks, and OpenTelemetry instrumentation for all service projects in the solution. [1] [2]
  • API Service: Created a new API service (HFMCP.GenImage.ApiService) with OpenAPI support, health checks, and default endpoints for interacting with AI models. [1] [2] [3]

Application Host:

  • AppHost: Added an orchestration project (HFMCP.GenImage.AppHost) to manage the solution's components, including the API service and web frontend. Configured health checks and service references for seamless integration. [1] [2]

Web Frontend Enhancements:

  • Blazor Components: Introduced key components for the web application, including App.razor and MainLayout.razor, to structure the user interface and provide navigation. [1] [2]

elbruno added 5 commits July 22, 2025 09:24
…gging Face and Ollama APIs

- Created Visual Studio solution file for the project.
- Added MCP-01-HuggingFace project with necessary dependencies and implemented image generation logic.
- Added MCP-02-HuggingFace-Ollama project with dependencies for OllamaSharp and implemented image generation logic.
- Configured environment variables and user secrets for API keys and deployment names.
- Implemented client setup for both Hugging Face and Ollama APIs to generate images based on user queries.
…CP-ConsoleApps

- Created HFMCP.GenImage.sln with multiple projects including AppHost, ServiceDefaults, ApiService, and Web.
- Established project configurations for Debug and Release modes.
- Created HuggingFace-MCP-ConsoleApps.sln with solution properties and a unique SolutionGuid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant