Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Examples/Examples/Chat/ChatWithImageGenExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using MaIN.Core.Hub;
using MaIN.Domain.Models;
using MaIN.Domain.Models.Abstract;
using MaIN.Domain.Models.Concrete;

namespace Examples.Chat;

Expand All @@ -11,10 +12,13 @@ public async Task Start()
{
Console.WriteLine("ChatExample with image gen is running!");

ModelRegistry.RegisterOrReplace(new GenericLocalModel(Models.Local.Flux1Shnell));
ModelRegistry.RegisterOrReplace(new StableDiffusion1_5());

await AIHub.Model().EnsureDownloadedAsync(Models.Local.StableDiffusion1_5);

var result = await AIHub.Chat()
.WithModel(Models.Local.Flux1Shnell)
.WithMessage("Generate cyberpunk godzilla cat warrior")
.WithModel(Models.Local.StableDiffusion1_5)
.WithMessage("Fluffy cat with a book - anime style")
.CompleteAsync();

ImagePreview.ShowImage(result.Message.Image);
Expand Down
20 changes: 0 additions & 20 deletions ImageGen/Dockerfile

This file was deleted.

66 changes: 0 additions & 66 deletions ImageGen/main.py

This file was deleted.

11 changes: 0 additions & 11 deletions ImageGen/requirements.txt

This file was deleted.

14 changes: 3 additions & 11 deletions MaIN.Core.E2ETests/ChatTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using MaIN.Domain.Entities;
using MaIN.Domain.Models;
using MaIN.Domain.Models.Abstract;
using MaIN.Domain.Models.Concrete;

namespace MaIN.Core.E2ETests;

Expand Down Expand Up @@ -127,22 +128,13 @@ Fuzzy match failed!
[Fact(Skip = "Require powerful GPU")]
public async Task Should_GenerateImage_BasedOnPrompt()
{
Assert.True(NetworkHelper.PingHost("127.0.0.1", 5003, 5), "Please make sure ImageGen service is running on port 5003");
ModelRegistry.RegisterOrReplace(new StableDiffusion1_5());

const string extension = "png";

var fluxModel = new GenericLocalModel("FLUX.1_Shnell");
ModelRegistry.RegisterOrReplace(fluxModel);
var result = await AIHub.Chat()
.WithModel(fluxModel.Id)
.WithModel(Models.Local.StableDiffusion1_5)
.WithMessage("Generate cat in Rome. Sightseeing, colloseum, ancient builidngs, Italy.")
.CompleteAsync();

if (string.IsNullOrWhiteSpace(extension) || extension.Contains("."))
{
throw new ArgumentException("Invalid file extension");
}

Assert.True(result.Done);
Assert.NotNull(result.Message.Image);
}
Expand Down
6 changes: 6 additions & 0 deletions Releases/0.10.14.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 0.10.14 release

- Local image generation now runs in-process via StableDiffusion.NET (GGUF diffusion models on CPU/CUDA), replacing the external Python/Flask image-gen service.
- Adds local diffusion model catalog (`StableDiffusion1_5`, `Flux1Shnell`, `QwenImage`) with multi-asset downloads (VAE/CLIP/T5/etc) via `AIHub.Model().EnsureDownloadedAsync()`.
- InferPage Settings now lists local diffusion models for the Self backend, tagged "Image Gen", and resolves custom model paths correctly for image generation.
- Removes the `ImageGen` Python service, Docker image, and `MaIN__ImageGenUrl` setting.
3 changes: 0 additions & 3 deletions scripts/image_gen_wrapper.sh

This file was deleted.

4 changes: 1 addition & 3 deletions scripts/install-mcli.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ $itemsToCopy = @{
"mcli.ps1",
"start.ps1",
"start-api.ps1",
"start-image-gen.ps1",
"download-models.ps1",
"docker-compose.yml",
"models_map.txt",
".models"
)
Directories = @(
"server",
"ImageGen"
"server"
)
}
# Copy files
Expand Down
21 changes: 1 addition & 20 deletions scripts/mcli.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ Usage:
mcli <command> [options]

Commands:
start-demo Start all services (API, image generation, and download models)
start-demo Start all services (API and download models)
api Start only the API service
image-gen Start only the image generation service
model Download and manage models
help Show this help message
uninstall Uninstall mcli
Expand All @@ -45,7 +44,6 @@ Options for 'start':
--hard Hard cleanup of containers
--no-api Skip starting the API
--no-models Skip model downloads
--no-image-gen Skip image generation
--models=<list> Specify comma-separated list of models to download

Options for 'api':
Expand All @@ -59,7 +57,6 @@ Options for 'model':

Examples:
mcli start-demo
mcli start-demo --no-image-gen
mcli api --hard
mcli model download gemma2-2b-maIN
mcli help
Expand All @@ -81,12 +78,10 @@ Options:
--hard Perform hard cleanup of containers before starting
--no-api Skip starting the API
--no-models Skip model downloads
--no-image-gen Skip image generation
--models=<list> Specify comma-separated list of models to download

Examples:
mcli start-demo
mcli start-demo --no-image-gen
mcli start-demo --models=gemma2-2b-maIN
"@
}
Expand All @@ -103,17 +98,6 @@ Options:
Examples:
mcli api
mcli api --hard
"@
}
"image-gen" {
Write-Host @"
mcli image-gen - Start the image generation service

Usage:
mcli image-gen

Examples:
mcli image-gen
"@
}
"model" {
Expand Down Expand Up @@ -150,9 +134,6 @@ switch ($command) {
"api" {
& "$PSScriptRoot\start-api.ps1" $arguments
}
"image-gen" {
& "$PSScriptRoot\start-image-gen.ps1" $arguments
}
"model" {
$subcommand = $arguments[0]
$modelArgs = $arguments[1..($arguments.Length-1)]
Expand Down
70 changes: 0 additions & 70 deletions scripts/start-image-gen.ps1

This file was deleted.

11 changes: 0 additions & 11 deletions scripts/start.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ $hard = $false
$models = @()
$noApi = $false
$apiOnly = $false
$noImageGen = $false
$noModels = $false

# Parse command-line arguments
Expand All @@ -32,9 +31,6 @@ foreach ($arg in $arguments) {
elseif ($arg -eq '--api-only') {
$apiOnly = $true
}
elseif ($arg -eq '--no-image-gen') {
$noImageGen = $true
}
elseif ($arg -eq '--no-models') {
$noModels = $true
}
Expand All @@ -49,7 +45,6 @@ Write-Host "Hard: $hard"
Write-Host "Models: $($models -join ', ')"
Write-Host "No API: $noApi"
Write-Host "API Only: $apiOnly"
Write-Host "No Image Gen: $noImageGen"
Write-Host "No Models: $noModels"

# Run setup tasks unless --api-only is provided
Expand All @@ -63,12 +58,6 @@ if (-not $apiOnly) {
& "$PSScriptRoot\download-models.ps1"
}
}

# Handle Image Generation API unless --no-image-gen is specified
if (-not $noImageGen) {
Write-Host "Starting Image Generation API as a background job..."
Start-Process -FilePath "powershell.exe" -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSScriptRoot\start-image-gen.ps1`"" -NoNewWindow
}
}

# Start API unless --no-api is specified
Expand Down
Loading