Instructions to use roshikhan301/NEWONE1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use roshikhan301/NEWONE1 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("roshikhan301/NEWONE1", 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
Download .dev_scripts/diff_images.py from roshikhan301/NEWONE1: direct link, hf CLI and curl.
- Browser
- Download file 743 Bytes
-
https://huggingface.co/roshikhan301/NEWONE1/resolve/main/.dev_scripts/diff_images.py
- Command line
-
hf download hf://roshikhan301/NEWONE1/.dev_scripts/diff_images.py
-
curl -L -o diff_images.py https://huggingface.co/roshikhan301/NEWONE1/resolve/main/.dev_scripts/diff_images.py
743 Bytes
| import argparse | |
| import numpy as np | |
| from PIL import Image | |
| def read_image_int16(image_path): | |
| image = Image.open(image_path) | |
| return np.array(image).astype(np.int16) | |
| def calc_images_mean_L1(image1_path, image2_path): | |
| image1 = read_image_int16(image1_path) | |
| image2 = read_image_int16(image2_path) | |
| assert image1.shape == image2.shape | |
| mean_L1 = np.abs(image1 - image2).mean() | |
| return mean_L1 | |
| def parse_args(): | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("image1_path") | |
| parser.add_argument("image2_path") | |
| args = parser.parse_args() | |
| return args | |
| if __name__ == "__main__": | |
| args = parse_args() | |
| mean_L1 = calc_images_mean_L1(args.image1_path, args.image2_path) | |
| print(mean_L1) | |