1
Some checks failed
CI / lint (push) Failing after 1m2s

This commit is contained in:
zcr
2026-03-18 10:23:31 +08:00
parent d89a176b63
commit 1c33f35aed
2 changed files with 14 additions and 15 deletions

View File

@@ -93,14 +93,15 @@ class FluxKleinAPI(ls.LitAPI):
W = request.get("width", 512)
H = request.get("height", 512)
images = []
for path in input_image_paths:
bucket, *rest = path.split("/", 1) # 拆分为 ["test", "typical_b/uildi/ng_space_station.png"]
object_name = rest[0] if rest else ""
image = oss_get_image(oss_client=minio_client, bucket=bucket, object_name=object_name)
images.append(image)
if input_image_paths:
for path in input_image_paths:
bucket, *rest = path.split("/", 1)
object_name = rest[0] if rest else ""
image = oss_get_image(oss_client=minio_client, bucket=bucket, object_name=object_name)
images.append(image)
return {
"bucket_name": request.get("bucket_name", None),
"object_name": request.get("object_name", None),
"bucket_name": request.get("bucket_name", "test"),
"object_name": request.get("object_name", f"fida_generate_image/{uuid.uuid4().hex}.png"),
"images": images,
"prompt": request.get("prompt", ""),
"steps": request.get("steps", 4),
@@ -115,15 +116,14 @@ class FluxKleinAPI(ls.LitAPI):
# 3. 执行推理逻辑
images = payload.get("images", [])
prompt = payload.get("prompt", "")
W, H = aspect_to_wh(payload["aspect_ratio"], payload["base_long_edge"])
gen = torch.Generator(device=self.device)
output = {}
if images:
output['im'] = self.pipe(
image=images,
prompt=prompt,
height=H,
width=W,
height=payload.get("height", 512),
width=payload.get("width", 512),
guidance_scale=payload["guidance"],
num_inference_steps=payload["steps"],
generator=gen,
@@ -131,8 +131,8 @@ class FluxKleinAPI(ls.LitAPI):
else:
output = self.pipe(
prompt=prompt,
height=H,
width=W,
height=payload.get("height", 512),
width=payload.get("width", 512),
guidance_scale=payload["guidance"],
num_inference_steps=payload["steps"],
generator=gen,

View File

@@ -61,8 +61,7 @@ def oss_upload_image(oss_client, bucket, object_name, image_bytes):
if __name__ == '__main__':
url = "fida-test/furniture/sketches/4449a66d-6267-43f7-86a2-1e42bd19ec61.png"
read_type = "2"
img = oss_get_image(oss_client=minio_client, bucket=url.split('/')[0], object_name=url[url.find('/') + 1:], data_type=read_type)
url = "test/fida_generate_image/692932cfecd9499688899812737a369c.png"
img = oss_get_image(oss_client=minio_client, bucket=url.split('/')[0], object_name=url[url.find('/') + 1:])
img.show()
img.save("result.png")