diff --git a/src/comfyworkflows/prototyping_style_flux_wan22.json b/src/comfyworkflows/prototyping_style_flux_wan22.json index 0cd4aff..d1ea7d9 100644 --- a/src/comfyworkflows/prototyping_style_flux_wan22.json +++ b/src/comfyworkflows/prototyping_style_flux_wan22.json @@ -524,7 +524,7 @@ }, "111": { "inputs": { - "strength": 0.15, + "strength": 0.5, "conditioning": [ "105", 0 diff --git a/src/lib/video-generator-styled.ts b/src/lib/video-generator-styled.ts index 87ac591..6ba6112 100644 --- a/src/lib/video-generator-styled.ts +++ b/src/lib/video-generator-styled.ts @@ -18,7 +18,7 @@ async function generateStyledVideo( comfyBaseUrl: string, comfyOutputDir: string, size: VideoSize = { width: 320, height: 640 } -): Promise { +): Promise<{ videoPath: string, imagePath: string }> { const COMFY_BASE_URL = comfyBaseUrl.replace(/\/$/, ''); const COMFY_OUTPUT_DIR = comfyOutputDir; 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(sourceImagePath); - return newVideoPath; + return { videoPath: newVideoPath, imagePath: newImagePath } } export { generateStyledVideo }; diff --git a/src/piterest_styletransfer_video.ts b/src/piterest_styletransfer_video.ts index 2242b52..23d1dd5 100644 --- a/src/piterest_styletransfer_video.ts +++ b/src/piterest_styletransfer_video.ts @@ -51,8 +51,8 @@ async function getPromptsForImage(imagePath: string, pinUrl: string, genre: stri 1. 'scene': A description of the image's environment. 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'). - 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. - 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. + 4. 'image_prompt': A short and detailed prompt to generate this photo. + 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: --- @@ -60,7 +60,7 @@ async function getPromptsForImage(imagePath: string, pinUrl: string, genre: stri "scene": "{result comes here}", "action": "{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}" } --- @@ -92,7 +92,7 @@ async function generateImageAndVideo(task: GenerationTask, server: { baseUrl: st logger.info(`Copied ${renamedImagePath} to ${destPath}`); const videoFileName = imageFileName.replace('.png', '.mp4'); - await generateStyledVideo( + const { videoPath, imagePath } = await generateStyledVideo( imagePrompt, videoPrompt, imageFileName, @@ -101,8 +101,8 @@ async function generateImageAndVideo(task: GenerationTask, server: { baseUrl: st outputDir, { width: 720, height: 1280 } ); - const videoPath = path.join(outputDir, videoFileName); - return { imagePath: destPath, videoPath }; + path.join(outputDir, videoFileName); + return { imagePath: imagePath, videoPath }; } catch (error) { logger.error(`Failed to generate styled video for ${imageFileName} on server ${baseUrl}:`, error); return null; @@ -196,16 +196,14 @@ async function getPinUrlFromPinterest(keyword: string): Promise { (async () => { const keywords = [ - { genre: "fantasy", subGenre: "ethereal" }, - { genre: "fantasy", subGenre: "academia" }, - { genre: "fantasy", subGenre: "darkacademia" }, - { genre: "fantasy", subGenre: "illumication" }, - { genre: "fantasy", subGenre: "aesthetic" }, - { genre: "abstract", subGenre: "particle" }, - { genre: "abstract", subGenre: "space" }, - { genre: "abstract", subGenre: "science" }, - { genre: "abstract", subGenre: "sphere" }, - { genre: "abstract", subGenre: "cubic" }, + { genre: "fantasy", subGenre: "ethereal", pinId: "311311393008071543" }, + { genre: "fantasy", subGenre: "ethereal", pinId: "1688918605889326" }, + { genre: "fantasy", subGenre: "ethereal", pinId: "4925880837133615" }, + { genre: "fantasy", subGenre: "ethereal", pinId: "985231163711528" }, + { genre: "fantasy", subGenre: "dark ethereal", pinId: "768497123954670531" }, + { genre: "fantasy", subGenre: "dark ethereal", pinId: "5840674510388768" }, + { genre: "fantasy", subGenre: "dark ethereal", pinId: "281123201734741654" }, + { genre: "fantasy", subGenre: "dark ethereal", pinId: "41306521578186951" }, ]; if (servers.length === 0) { @@ -219,12 +217,21 @@ async function getPinUrlFromPinterest(keyword: string): Promise { const { genre, subGenre } = genreSubGenre; - const keyword = `${genre} ${subGenre}`; - logger.info(`Searching for a pin with keyword: ${keyword}`); - const pin = await getPinUrlFromPinterest(keyword); + const pinId = (genreSubGenre as any).pinId; + let pin: string | null = null; + + 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) { - 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; }