Instructions to use AmrDabour/image-colorizer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use AmrDabour/image-colorizer with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("AmrDabour/image-colorizer", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Image Colorization Model
This model colorizes grayscale images using a Stable Diffusion ControlNet approach.
Usage
# Install required dependencies
pip install diffusers tensorflow torch
# Load and use the model
from huggingface_hub import hf_hub_download
import tensorflow as tf
from tensorflow import keras
import os
# Define the ColorizeModel class (same as in the original notebook)
# [Insert the ColorizeModel class definition here]
# Download the model files
model_path = hf_hub_download(repo_id="AmrDabour/image-colorizer", filename="image_colorizer.h5")
component_path = os.path.dirname(os.path.dirname(model_path)) + "/models--AmrDabour--image-colorizer/snapshots/COMMIT_HASH"
# Load and use the model
with keras.utils.custom_object_scope({'ColorizeModel': ColorizeModel}):
loaded_model = keras.models.load_model(model_path, compile=False)
result = loaded_model.colorize("your_grayscale_image.jpg", output_path="colored_output.png")
Replace AmrDabour and COMMIT_HASH with appropriate values.
- Downloads last month
- -
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support