save latest changes

This commit is contained in:
2025-08-27 11:17:34 +02:00
parent 3d239d039b
commit d4028e8f7f
3 changed files with 30 additions and 23 deletions

View File

@ -524,7 +524,7 @@
}, },
"111": { "111": {
"inputs": { "inputs": {
"strength": 0.15, "strength": 0.5,
"conditioning": [ "conditioning": [
"105", "105",
0 0

View File

@ -18,7 +18,7 @@ async function generateStyledVideo(
comfyBaseUrl: string, comfyBaseUrl: string,
comfyOutputDir: string, comfyOutputDir: string,
size: VideoSize = { width: 320, height: 640 } size: VideoSize = { width: 320, height: 640 }
): Promise<string> { ): Promise<{ videoPath: string, imagePath: string }> {
const COMFY_BASE_URL = comfyBaseUrl.replace(/\/$/, ''); const COMFY_BASE_URL = comfyBaseUrl.replace(/\/$/, '');
const COMFY_OUTPUT_DIR = comfyOutputDir; const COMFY_OUTPUT_DIR = comfyOutputDir;
const workflow = JSON.parse(await fs.readFile('src/comfyworkflows/prototyping_style_flux_wan22.json', 'utf-8')); const workflow = JSON.parse(await fs.readFile('src/comfyworkflows/prototyping_style_flux_wan22.json', 'utf-8'));
@ -87,7 +87,7 @@ async function generateStyledVideo(
// await fs.unlink(sourceVideoPath); // await fs.unlink(sourceVideoPath);
// await fs.unlink(sourceImagePath); // await fs.unlink(sourceImagePath);
return newVideoPath; return { videoPath: newVideoPath, imagePath: newImagePath }
} }
export { generateStyledVideo }; export { generateStyledVideo };

View File

@ -51,8 +51,8 @@ async function getPromptsForImage(imagePath: string, pinUrl: string, genre: stri
1. 'scene': A description of the image's environment. 1. 'scene': A description of the image's environment.
2. 'action': A description of the main action occurring in the image. 2. 'action': A description of the main action occurring in the image.
3. 'camera': A description of the camera shot (e.g., 'close-up', 'wide-angle'). 3. 'camera': A description of the camera shot (e.g., 'close-up', 'wide-angle').
4. 'image_prompt': A highly detailed, creative, and artistic prompt for an image generation model, inspired by the original. This prompt should be around 200 words. 4. 'image_prompt': A short and detailed prompt to generate this photo.
5. 'video_prompt': A prompt for an 8-second video, describing a creative and subtle movement of the main object. The camera should be static, but slight panning is acceptable. 5. 'video_prompt': A prompt describing a creative and subtle movement of the main object. The camera should be slight panning or static.
Output should be in this JSON format: Output should be in this JSON format:
--- ---
@ -60,7 +60,7 @@ async function getPromptsForImage(imagePath: string, pinUrl: string, genre: stri
"scene": "{result comes here}", "scene": "{result comes here}",
"action": "{result comes here}", "action": "{result comes here}",
"camera": "{result comes here}", "camera": "{result comes here}",
"image_prompt": "Ultra detailed illustration, {result comes here}", "image_prompt": "{result comes here}",
"video_prompt": "{result comes here}" "video_prompt": "{result comes here}"
} }
--- ---
@ -92,7 +92,7 @@ async function generateImageAndVideo(task: GenerationTask, server: { baseUrl: st
logger.info(`Copied ${renamedImagePath} to ${destPath}`); logger.info(`Copied ${renamedImagePath} to ${destPath}`);
const videoFileName = imageFileName.replace('.png', '.mp4'); const videoFileName = imageFileName.replace('.png', '.mp4');
await generateStyledVideo( const { videoPath, imagePath } = await generateStyledVideo(
imagePrompt, imagePrompt,
videoPrompt, videoPrompt,
imageFileName, imageFileName,
@ -101,8 +101,8 @@ async function generateImageAndVideo(task: GenerationTask, server: { baseUrl: st
outputDir, outputDir,
{ width: 720, height: 1280 } { width: 720, height: 1280 }
); );
const videoPath = path.join(outputDir, videoFileName); path.join(outputDir, videoFileName);
return { imagePath: destPath, videoPath }; return { imagePath: imagePath, videoPath };
} catch (error) { } catch (error) {
logger.error(`Failed to generate styled video for ${imageFileName} on server ${baseUrl}:`, error); logger.error(`Failed to generate styled video for ${imageFileName} on server ${baseUrl}:`, error);
return null; return null;
@ -196,16 +196,14 @@ async function getPinUrlFromPinterest(keyword: string): Promise<string | null> {
(async () => { (async () => {
const keywords = [ const keywords = [
{ genre: "fantasy", subGenre: "ethereal" }, { genre: "fantasy", subGenre: "ethereal", pinId: "311311393008071543" },
{ genre: "fantasy", subGenre: "academia" }, { genre: "fantasy", subGenre: "ethereal", pinId: "1688918605889326" },
{ genre: "fantasy", subGenre: "darkacademia" }, { genre: "fantasy", subGenre: "ethereal", pinId: "4925880837133615" },
{ genre: "fantasy", subGenre: "illumication" }, { genre: "fantasy", subGenre: "ethereal", pinId: "985231163711528" },
{ genre: "fantasy", subGenre: "aesthetic" }, { genre: "fantasy", subGenre: "dark ethereal", pinId: "768497123954670531" },
{ genre: "abstract", subGenre: "particle" }, { genre: "fantasy", subGenre: "dark ethereal", pinId: "5840674510388768" },
{ genre: "abstract", subGenre: "space" }, { genre: "fantasy", subGenre: "dark ethereal", pinId: "281123201734741654" },
{ genre: "abstract", subGenre: "science" }, { genre: "fantasy", subGenre: "dark ethereal", pinId: "41306521578186951" },
{ genre: "abstract", subGenre: "sphere" },
{ genre: "abstract", subGenre: "cubic" },
]; ];
if (servers.length === 0) { if (servers.length === 0) {
@ -219,12 +217,21 @@ async function getPinUrlFromPinterest(keyword: string): Promise<string | null> {
const { genre, subGenre } = genreSubGenre; const { genre, subGenre } = genreSubGenre;
const keyword = `${genre} ${subGenre}`; const pinId = (genreSubGenre as any).pinId;
logger.info(`Searching for a pin with keyword: ${keyword}`); let pin: string | null = null;
const pin = await getPinUrlFromPinterest(keyword);
if (pinId) {
pin = `https://www.pinterest.com/pin/${pinId}/`;
logger.info(`Using direct pin URL for pinId: ${pinId}`);
} /* else {
// Uncomment the block below to enable searching by term instead of using pinId.
// const searchTerm = (genreSubGenre as any).search || `${genre} ${subGenre}`;
// logger.info(`Searching for a pin with search term: ${searchTerm}`);
// pin = await getPinUrlFromPinterest(searchTerm);
} */
if (!pin) { if (!pin) {
logger.warn(`Could not find a pin for keyword: ${keyword}. Skipping.`); logger.warn(`No pinId provided and search is disabled for genre: ${genre}, subGenre: ${subGenre}. Skipping.`);
continue; continue;
} }