Skip to content
/ HeyIm Public

Full-stack AI image generation web application optimized for Apple Silicon. All inference runs natively using Core ML + ANE

License

Notifications You must be signed in to change notification settings

phucdhh/HeyIm

Repository files navigation

HeyIm — Ứng dụng Web tạo hình ảnh bằng AI

License: MIT Swift 5.8+ Next.js 16

🇻🇳 Tiếng Việt | 🇬🇧 English

Website: https://heyim.truyenthong.edu.vn

Ứng dụng web tạo hình ảnh AI tối ưu cho Apple Silicon (Mac Mini M2). Toàn bộ inference chạy native bằng Core ML + ANE (Neural Engine).

Tổng quan

HeyIm sử dụng RealisticVision v5.1 - mô hình Stable Diffusion 1.5 finetuned chuyên về chân dung và portrait photography, được tối ưu hoá cho Apple Neural Engine. HeyIm có thể chạy hoàn toàn trên ANE và chỉ dùng một ít CPU, nên hầu như không ảnh hưởng gì đến hệ thống. Bạn có thể dùng GPU để chạy một AI khác mà không ảnh hưởng gì. Trong trường hợp cùng lúc chạy một ứng dụng nặng về xử lý CPU, một ứng dụng AI LLMs 100% GPU và HeyIm 100% ANE, thì Mac Mini M2 cũng chỉ lên cỡ 15-20W, và gần như không nóng máy.

Tính năng chính

  • Tốc độ nhanh: 8-10 giây mỗi ảnh
  • �� Chất lượng cao: Chuyên về portraits, faces, people
  • 🖼️ Image-to-Image: Upload và chỉnh sửa ảnh, thay đổi context/behavior
  • 🖥️ Tối ưu M2: Chạy hoàn toàn trên ANE, rất tiết kiệm điện
  • 🌐 Giao diện web: Next.js + TypeScript
  • �� An toàn: Xử lý local, không gửi data ra ngoài

Performance

Mac Mini M2 (16GB - 24 GB RAM):

  • Steps 20: ~7-8s
  • Steps 30: ~9-10s ⭐ Nên chọn
  • Steps 40: ~12-13s

Hardware Usage:

  • ANE: 80-100% (UNet 1.6GB, rất tiết kiệm điện)
  • CPU: 10-20%
  • GPU: 0% (Không cần sử dụng GPU)
  • RAM: ~4-5GB

Quick Start

# Backend
cd backend && swift build -c release
.build/release/HeyImServer

# Frontend  
cd frontend && npm install && npm run dev

Truy cập: http://localhost:5859

Model: RealisticVision v5.1

  • Size: 3.6GB (Core ML, FP16)
  • Type: Stable Diffusion 1.5
  • Specialization: Portrait photography
  • Format: SPLIT_EINSUM (ANE optimized)

API

Generate Image (Text-to-Image)

POST http://localhost:5858/api/generate
{
  "prompt": "portrait photo of a woman, professional photography",
  "steps": 30,
  "cfgScale": 8.0
}

Image-to-Image Editing

POST http://localhost:5858/api/generate
{
  "prompt": "same person but in business suit, office background",
  "steps": 25,
  "cfgScale": 7.5,
  "inputImage": "base64_encoded_image_data",
  "strength": 0.7
}

Strength Guide:

  • 0.1-0.3: Subtle changes (lighting, colors)
  • 0.4-0.7: Moderate changes (style, clothing, expression)
  • 0.8-1.0: Major changes (full composition)

Status

GET http://localhost:5858/api/status

Prompting Tips (Cần nhập prompt bằng tiếng Anh)

Good prompts:

portrait photo of a beautiful woman, long hair, professional photography,
soft lighting, bokeh, 8k uhd, high quality

Negative prompt:

ugly, blurry, low quality, distorted, deformed, bad anatomy

Cấu trúc

HeyIm/
├── backend/          # Swift + Vapor
├── frontend/         # Next.js
├── models/           # Core ML models (3.6GB)
└── scripts/          # Utilities

Production Deployment

Caddy (Reverse Proxy)

heyim.truyenthong.edu.vn {
    reverse_proxy localhost:5860
}

Cloudflare Tunnel

cloudflared tunnel --url http://localhost:5860

License

MIT License


Made with ❤️ for Mac Mini M2

About

Full-stack AI image generation web application optimized for Apple Silicon. All inference runs natively using Core ML + ANE

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published