Transformers

Run this model with HF Jobs

Run airomix/sd on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/airomix/sd. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/airomix/sd on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
sd / scripts /postprocessing_gfpgan.py
airomix's picture
Upload 511 files
8e68b99
Raw History Blame Contribute Delete
1.1 kB
from PIL import Image
import numpy as np
from modules import scripts_postprocessing, gfpgan_model, ui_components
import gradio as gr
class ScriptPostprocessingGfpGan(scripts_postprocessing.ScriptPostprocessing):
name = "GFPGAN"
order = 2000
def ui(self):
with ui_components.InputAccordion(False, label="GFPGAN") as enable:
gfpgan_visibility = gr.Slider(minimum=0.0, maximum=1.0, step=0.001, label="Visibility", value=1.0, elem_id="extras_gfpgan_visibility")
return {
"enable": enable,
"gfpgan_visibility": gfpgan_visibility,
}
def process(self, pp: scripts_postprocessing.PostprocessedImage, enable, gfpgan_visibility):
if gfpgan_visibility == 0 or not enable:
return
restored_img = gfpgan_model.gfpgan_fix_faces(np.array(pp.image, dtype=np.uint8))
res = Image.fromarray(restored_img)
if gfpgan_visibility < 1.0:
res = Image.blend(pp.image, res, gfpgan_visibility)
pp.image = res
pp.info["GFPGAN visibility"] = round(gfpgan_visibility, 3)