mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-03-13 17:09:49 +00:00
revise space
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import spaces
|
||||
import math
|
||||
import os
|
||||
import gradio as gr
|
||||
import numpy as np
|
||||
import torch
|
||||
@@ -132,6 +133,11 @@ i2i_pipe = StableDiffusionImg2ImgPipeline(
|
||||
spaces.automatically_move_pipeline_components(t2i_pipe)
|
||||
|
||||
|
||||
def overwrite_components(components):
|
||||
global tokenizer, text_encoder, vae, unet, t2i_pipe, i2i_pipe
|
||||
tokenizer, text_encoder, vae, unet, t2i_pipe, i2i_pipe = components
|
||||
|
||||
|
||||
@torch.inference_mode()
|
||||
def encode_prompt_inner(txt: str):
|
||||
max_length = tokenizer.model_max_length
|
||||
@@ -234,8 +240,14 @@ def run_rmbg(img, sigma=0.0):
|
||||
return result.clip(0, 255).astype(np.uint8), alpha
|
||||
|
||||
|
||||
external_processor = None
|
||||
|
||||
|
||||
@torch.inference_mode()
|
||||
def process(input_fg, prompt, image_width, image_height, num_samples, seed, steps, a_prompt, n_prompt, cfg, highres_scale, highres_denoise, lowres_denoise, bg_source):
|
||||
if external_processor is not None:
|
||||
return external_processor(input_fg, prompt, image_width, image_height, num_samples, seed, steps, a_prompt, n_prompt, cfg, highres_scale, highres_denoise, lowres_denoise, bg_source)
|
||||
|
||||
bg_source = BGSource(bg_source)
|
||||
input_bg = None
|
||||
|
||||
|
||||
@@ -403,7 +403,7 @@ def prepare_environment():
|
||||
# stable_diffusion_xl_commit_hash = os.environ.get('STABLE_DIFFUSION_XL_COMMIT_HASH', "45c443b316737a4ab6e40413d7794a7f5657c19f")
|
||||
# k_diffusion_commit_hash = os.environ.get('K_DIFFUSION_COMMIT_HASH', "ab527a9a6d347f364e3d185ba6d714e22d80cb3c")
|
||||
huggingface_guess_commit_hash = os.environ.get('HUGGINGFACE_GUESS_HASH', "84826248b49bb7ca754c73293299c4d4e23a548d")
|
||||
google_blockly_commit_hash = os.environ.get('GOOGLE_BLOCKLY_COMMIT_HASH', "bf36e6fd3750a081f44209ba4f645adb598f7e37")
|
||||
google_blockly_commit_hash = os.environ.get('GOOGLE_BLOCKLY_COMMIT_HASH', "1e98997c7fedaf5106af9849b6f50ebe5c4408f1")
|
||||
blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9")
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user