save current changes
This commit is contained in:
30
src/index.ts
30
src/index.ts
@ -1 +1,29 @@
|
||||
console.log("Hello, TypeScript! 2");
|
||||
import { downloadPinterestImages } from './lib/downloader';
|
||||
import { describeImage } from './lib/image-describer';
|
||||
import { logger, setLogLevel, LogLevel } from './lib/logger';
|
||||
|
||||
(async () => {
|
||||
const keyword = 'cyberpunk city';
|
||||
const numberOfPages = 1;
|
||||
const imagePaths = await downloadPinterestImages(keyword, numberOfPages);
|
||||
logger.info('Downloaded images:', imagePaths);
|
||||
|
||||
for (const imagePath of imagePaths) {
|
||||
try {
|
||||
const llmResponseJSON = await describeImage(imagePath,
|
||||
`Describe this image as a prompt for an image generation model.
|
||||
Prompt should be in 200 words.
|
||||
Output should be in this format
|
||||
---
|
||||
{
|
||||
"prompt":""
|
||||
}
|
||||
---
|
||||
`);
|
||||
const prompt = llmResponseJSON.prompt;
|
||||
logger.info(`Description for ${imagePath}:`, prompt);
|
||||
} catch (error) {
|
||||
logger.error(`Failed to describe ${imagePath}:`, error);
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user