sky-admin
commited on
Commit
•
48e3224
1
Parent(s):
9fd02c7
add hr
Browse files
models/RealESRGAN/RealESRGAN_x4plus.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4fa0d38905f75ac06eb49a7951b426670021be3018265fd191d2125df9d682f1
|
3 |
+
size 67040989
|
models/RealESRGAN/RealESRGAN_x4plus_anime_6B.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f872d837d3c90ed2e05227bed711af5671a6fd1c9f7d7e91c911a61f155e99da
|
3 |
+
size 17938799
|
models/RealESRGAN/realesr-general-x4v3.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8dc7edb9ac80ccdc30c3a5dca6616509367f05fbc184ad95b731f05bece96292
|
3 |
+
size 4885111
|
predict.py
CHANGED
@@ -100,6 +100,7 @@ class Predictor(BasePredictor):
|
|
100 |
cfg_scale: int = Input(description="cfg scale", default=8),
|
101 |
width: int = Input(description="width", default=512),
|
102 |
height: int = Input(description="height", default=768),
|
|
|
103 |
seed: int = Input(description="seed", default=-1),
|
104 |
) -> Path:
|
105 |
"""Run a single prediction on the model"""
|
@@ -114,6 +115,8 @@ class Predictor(BasePredictor):
|
|
114 |
"cfg_scale": cfg_scale,
|
115 |
"width": width,
|
116 |
"height": height,
|
|
|
|
|
117 |
"seed": seed,
|
118 |
}
|
119 |
p = StableDiffusionProcessingTxt2Img(sd_model=shared.sd_model, **args)
|
@@ -122,38 +125,3 @@ class Predictor(BasePredictor):
|
|
122 |
processed.images[0].save(fp=filename, format="PNG")
|
123 |
# single_image_b64 = encode_pil_to_base64(processed.images[0]).decode('utf-8')
|
124 |
return Path(filename)
|
125 |
-
|
126 |
-
class PredictorOld(BasePredictor):
|
127 |
-
def setup(self):
|
128 |
-
"""Load the model into memory to make running multiple predictions efficient"""
|
129 |
-
initialize()
|
130 |
-
self.shared = shared
|
131 |
-
|
132 |
-
def predict(
|
133 |
-
self,
|
134 |
-
prompt: str = Input(description="prompt en"),
|
135 |
-
) -> Dict[str, Any]:
|
136 |
-
"""Run a single prediction on the model"""
|
137 |
-
args = {
|
138 |
-
"do_not_save_samples": True,
|
139 |
-
"do_not_save_grid": True,
|
140 |
-
"outpath_samples": "./output",
|
141 |
-
"prompt": "lora:koreanDollLikeness_v15:0.66, best quality, ultra high res, (photorealistic:1.4), 1girl, beige sweater, black choker, smile, laughing, bare shoulders, solo focus, ((full body), (brown hair:1), looking at viewer",
|
142 |
-
"negative_prompt": "paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans, (ugly:1.331), (duplicate:1.331), (morbid:1.21), (mutilated:1.21), (tranny:1.331), mutated hands, (poorly drawn hands:1.331), blurry, 3hands,4fingers,3arms, bad anatomy, missing fingers, extra digit, fewer digits, cropped, jpeg artifacts,poorly drawn face,mutation,deformed",
|
143 |
-
"sampler_name": "DPM++ SDE Karras",
|
144 |
-
"steps": 20, # 25
|
145 |
-
"cfg_scale": 8,
|
146 |
-
"width": 512,
|
147 |
-
"height": 768,
|
148 |
-
"seed": -1,
|
149 |
-
}
|
150 |
-
if len(prompt) > 0:
|
151 |
-
print("get prompt from request: ", prompt)
|
152 |
-
args["prompt"] = prompt
|
153 |
-
p = StableDiffusionProcessingTxt2Img(sd_model=self.shared.sd_model, **args)
|
154 |
-
processed = process_images(p)
|
155 |
-
single_image_b64 = encode_pil_to_base64(processed.images[0]).decode('utf-8')
|
156 |
-
return {
|
157 |
-
"img_data": single_image_b64,
|
158 |
-
"parameters": processed.images[0].info.get('parameters', ""),
|
159 |
-
}
|
|
|
100 |
cfg_scale: int = Input(description="cfg scale", default=8),
|
101 |
width: int = Input(description="width", default=512),
|
102 |
height: int = Input(description="height", default=768),
|
103 |
+
enable_hr: bool = Input(description="Generate high resoultion version", default=False),
|
104 |
seed: int = Input(description="seed", default=-1),
|
105 |
) -> Path:
|
106 |
"""Run a single prediction on the model"""
|
|
|
115 |
"cfg_scale": cfg_scale,
|
116 |
"width": width,
|
117 |
"height": height,
|
118 |
+
"enable_hr": enable_hr,
|
119 |
+
"hr_upscaler": "R-ESRGAN 4x+",
|
120 |
"seed": seed,
|
121 |
}
|
122 |
p = StableDiffusionProcessingTxt2Img(sd_model=shared.sd_model, **args)
|
|
|
125 |
processed.images[0].save(fp=filename, format="PNG")
|
126 |
# single_image_b64 = encode_pil_to_base64(processed.images[0]).decode('utf-8')
|
127 |
return Path(filename)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|