v2.1 - Face correction (GFPGAN) and Upscaling (RealESRGAN)

This commit is contained in:
cmdr2
2022-09-08 21:20:27 +05:30
parent 22089c528a
commit 253e75c747
6 changed files with 531 additions and 46 deletions

View File

@ -42,6 +42,9 @@ class ImageRequest(BaseModel):
turbo: bool = True
use_cpu: bool = False
use_full_precision: bool = False
use_face_correction: str = None # or "GFPGANv1.3"
use_upscale: str = None # or "RealESRGAN_x4plus" or "RealESRGAN_x4plus_anime_6B"
show_only_filtered_image: bool = False
@app.get('/')
def read_root():
@ -61,7 +64,7 @@ async def ping():
model_is_loading = True
from sd_internal import runtime
runtime.load_model(ckpt_to_use="sd-v1-4.ckpt")
runtime.load_model_ckpt(ckpt_to_use="sd-v1-4")
model_loaded = True
model_is_loading = False
@ -91,6 +94,9 @@ async def image(req : ImageRequest):
r.use_cpu = req.use_cpu
r.use_full_precision = req.use_full_precision
r.save_to_disk_path = req.save_to_disk_path
r.use_upscale: str = req.use_upscale
r.use_face_correction = req.use_face_correction
r.show_only_filtered_image = req.show_only_filtered_image
try:
res: Response = runtime.mk_img(r)