comic-generator-multilingual / src /models /characterGenerator.js
Comic Developer
Initial clean commit - Comic generator with SDXL
4595df6
const FireworksAPI = require('../utils/fireworks');
class CharacterGenerator {
constructor() {
this.fireworks = new FireworksAPI();
}
async generateCharacter(description) {
const prompt = `Create a detailed character portrait based on this description: ${description}.
The character should be visually distinct and interesting.
Art style: digital painting, high detail, fantasy`;
try {
const result = await this.fireworks.generateImage(prompt, {
model: 'stable-diffusion-xl-1024-v1-0',
steps: 30,
width: 512,
height: 512,
});
return {
characterImage: result.image,
description: description,
prompt: prompt,
};
} catch (error) {
console.error('Error generating character:', error);
throw error;
}
}
async generateCharacterWithFluxSchnell(description) {
// Simulating Flux Schnell functionality with optimized prompt engineering
const prompt = `flux schnell style, highly detailed character portrait, ${description},
fantasy character design, professional digital painting, intricate details,
vibrant colors, cinematic lighting, 8k resolution`;
try {
const result = await this.fireworks.generateImage(prompt, {
model: 'stable-diffusion-xl-1024-v1-0',
steps: 20, // Fewer steps for faster generation
width: 512,
height: 512,
});
return {
characterImage: result.image,
description: description,
prompt: prompt,
style: 'fluxSchnell',
};
} catch (error) {
console.error('Error generating character with Flux Schnell style:', error);
throw error;
}
}
}
module.exports = CharacterGenerator;