sace changes

This commit is contained in:
2025-09-26 20:55:43 +02:00
parent d362f9e0ca
commit e670975ee9
2 changed files with 38 additions and 44 deletions

View File

@ -16,22 +16,28 @@ const KEYWORDS = [
'ball gown dress', 'ball gown dress',
'cosplay outfit', 'cosplay outfit',
'vintage skirt outfit', 'vintage skirt outfit',
'casual skirt outfit']; 'casual skirt outfit',
'harajuku outfit',
'pop colorful outfit',
'cute colorful outfit',
'japanese idol outfit',
'folk dress outfit',
];
const TARGET_COUNT = Number(process.env.IMAGE_COUNT || 20); const TARGET_COUNT = Number(process.env.IMAGE_COUNT || 20);
const PROMPT = const PROMPT =
`Change pose of the person in the image1 to stantind in front of camera, with a smile, full body visible, wearing a fashionable outfit suitable for a casual day out. The background should be a white. Ensure the lighting is bright and natural, highlighting the details of the outfit and the person's features. `Change pose of the person in the image1 to stantind in front of camera, with a smile, full body visible, wearing a fashionable outfit suitable for a casual day out. The background should be a white. Ensure the lighting is bright and natural, highlighting the details of the outfit and the person's features.
`; `;
const PROMPT2 = const PROMPT2 =
`Extract clothes from image1, put it on the white backgroud `Extract clothes from image1, put it on the light gray backgroud
`; `;
type ServerCfg = { baseUrl: string; outputDir: string; inputDir: string }; type ServerCfg = { baseUrl: string; outputDir: string; inputDir: string };
function getServerConfig(): ServerCfg { function getServerConfig(): ServerCfg {
const candidates = [ const candidates = [
{ baseUrl: process.env.SERVER1_COMFY_BASE_URL, outputDir: process.env.SERVER1_COMFY_OUTPUT_DIR }, //{ baseUrl: process.env.SERVER1_COMFY_BASE_URL, outputDir: process.env.SERVER1_COMFY_OUTPUT_DIR },
//{ baseUrl: process.env.SERVER2_COMFY_BASE_URL, outputDir: process.env.SERVER2_COMFY_OUTPUT_DIR }, { baseUrl: process.env.SERVER2_COMFY_BASE_URL, outputDir: process.env.SERVER2_COMFY_OUTPUT_DIR },
].filter((s): s is { baseUrl: string; outputDir: string } => !!s.baseUrl && !!s.outputDir); ].filter((s): s is { baseUrl: string; outputDir: string } => !!s.baseUrl && !!s.outputDir);
if (candidates.length === 0) { if (candidates.length === 0) {
@ -101,26 +107,26 @@ async function processImages(imagePaths: string[], server: ServerCfg) {
logger.info(`Copied ${localImagePath} -> ${serverInputPath}`); logger.info(`Copied ${localImagePath} -> ${serverInputPath}`);
// Run conversion (sequential to avoid output race conditions) // Run conversion (sequential to avoid output race conditions)
const generatedPath1 = await convertImage( const generatedPath1 = await extractCloth(
PROMPT, PROMPT2,
baseName, baseName,
server.baseUrl, server.baseUrl,
server.outputDir, server.outputDir,
{ width: 720, height: 1280 } // portrait { width: 720, height: 1280 } // portrait
); );
/*
await fs.copyFile(generatedPath1, serverInputPath);
const baseName2 = path.basename(localImagePath);
await fs.copyFile(generatedPath1, serverInputPath); const generatedPath2 = await extractCloth(
const baseName2 = path.basename(localImagePath); PROMPT2,
baseName2,
const generatedPath2 = await extractCloth( server.baseUrl,
PROMPT2, server.outputDir,
baseName2, { width: 720, height: 1280 } // portrait
server.baseUrl, );
server.outputDir, */
{ width: 720, height: 1280 } // portrait logger.info(`Generated image: ${generatedPath1}`);
);
logger.info(`Generated image: ${generatedPath2}`);
} catch (err) { } catch (err) {
logger.error(`Failed to convert ${localImagePath}:`, err); logger.error(`Failed to convert ${localImagePath}:`, err);
} finally { } finally {

View File

@ -8,33 +8,21 @@ import { convertImage } from '../lib/image-converter';
dotenv.config(); dotenv.config();
const KEYWORDS = [ const KEYWORDS = [
'teen girl portrait', 'fullbody pose cute ',
'woman portrait', 'fullbody pose model ',
'woman face close', 'fullbody pose woman ',
'teen face close', 'fullbody pose idol ',
'beautiful woman face closeup', 'fullbody pose kawaii',
'beautiful teen', 'fullbody pose japanese',
'russian teen', 'fullbody pose kawaii sit',
'skandinavian teen', 'fullbody pose model sit',
'uk teen', 'fullbody pose cute sit',];
'asian teen',
'east european teen',
'cute teen',
'beautiful woman',
'russian woman',
'skandinavian woman',
'uk woman',
'asian woman',
'east european woman',
'cute woman',];
const TARGET_COUNT = Number(process.env.IMAGE_COUNT || 20); const TARGET_COUNT = Number(process.env.IMAGE_COUNT || 20);
const PROMPT = const PROMPT =
`change camera angle to closeup face from image1, `
change background to light gray with faing gradient, change camera angle to fullbody shot from image1,
change face angle to look at directry look at camera˛ change background to light gray with faing gradient,
change lighting to soft light, change clothes to shite sports bra and shite cotton short pants
change face expression to neautral expression,
change age to 20 years old,
`; `;
type ServerCfg = { baseUrl: string; outputDir: string; inputDir: string }; type ServerCfg = { baseUrl: string; outputDir: string; inputDir: string };