1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const axios = require('axios');
const FormData = require('form-data');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/storydiffusion";
const reqBody = {
"seed": 42,
"num_ids": 3,
"sd_model": "Unstable",
"num_steps": 25,
"image_width": 768,
"image_height": 768,
"sa32_setting": 0.5,
"sa64_setting": 0.5,
"output_format": "webp",
"guidance_scale": 5,
"output_quality": 80,
"negative_prompt": "bad anatomy, bad hands, missing fingers, extra fingers, three hands, three legs, bad arms, missing legs, missing arms, poorly drawn face, bad face, fused face, cloned face, three crus, fused feet, fused thigh, extra crus, ugly fingers, horn, cartoon, cg, 3d, unreal, animate, amputation, disconnected limbs",
"character_description": "a man, wearing black suit",
"comic_description": "at home, read new paper #at home, The newspaper says there is a treasure house in the forest.\non the road, near the forest\n[NC] The car on the road, near the forest #He drives to the forest in search of treasure.\n[NC]A tiger appeared in the forest, at night \nvery frightened, open mouth, in the forest, at night\nrunning very fast, in the forest, at night\n[NC] A house in the forest, at night #Suddenly, he discovers the treasure house!\nin the house filled with treasure, laughing, at night #He is overjoyed inside the house.",
"style_strength_ratio": 20,
"style_name": "Disney Charactor",
"comic_style": "Classic Comic Style"
};
(async function() {
try {
const formData = new FormData();
// Append regular fields
for (const key in reqBody) {
if (reqBody.hasOwnProperty(key)) {
formData.append(key, reqBody[key]);
}
}
// Convert and append images as Base64 if necessary
const response = await axios.post(url, formData, {
headers: {
'x-api-key': api_key,
...formData.getHeaders()
}
});
console.log(response.data);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);
}
})();
Random seed. Leave blank to randomize the seed
Number of id images in total images. This should not exceed total number of line-separated prompts
Allowed values:
Number of sample steps
min : 20,
max : 50
Reference image for the character
Allowed values:
Allowed values:
The degree of Paired Attention at 32 x 32 self-attention layers
min : 0,
max : 1
The degree of Paired Attention at 64 x 64 self-attention layers
min : 0,
max : 1
Allowed values:
Scale for classifier-free guidance
min : 0.1,
max : 10
Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality
min : 0,
max : 100
Describe things you do not want to see in the output
Add triger word 'img' when using ref_image. General description of the character. If ref_image above is provided, making sure to follow the class word you want to customize with the trigger word 'img', such as: 'man img' or 'woman img' or 'girl img'
Remove [NC] when using Ref_image Each frame is divided by a new line. Only the first 10 prompts are valid for demo speed! For comic_description NOT using ref_image: (1) Support Typesetting Style and Captioning. By default, the prompt is used as the caption for each image. If you need to change the caption, add a '#' at the end of each line. Only the part after the '#' will be added as a caption to the image. (2) The [NC] symbol is used as a flag to indicate that no characters should be present in the generated scene images. If you want do that, prepend the '[NC]' at the beginning of the line.
Style strength of Ref Image (%), only used if ref_image is provided
min : 15,
max : 50
Allowed values:
Allowed values:
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Story Diffusion leverages the power of diffusion models to generate a series of images that cohesively depict your story's scenes. It's like having a visual effects team at your fingertips, translating your words into a captivating visual experience. Story Diffusion goes beyond simply generating individual images. Its core strength lies in maintaining consistency across the entire sequence. Characters, settings, and overall mood remain thematically linked, ensuring a visually cohesive story arc.
This innovative model has far-reaching implications for various creative fields:
Concept Art and Illustration: Story Diffusion empowers artists and designers by generating visual references that perfectly capture the essence of their ideas. It acts as a springboard for further creative exploration.
Storyboarding and Pre-visualization: Filmmakers and animators can use Story Diffusion to create dynamic storyboards that visualize key scenes and plot points. This streamlines the pre-production process, saving time and resources.
Graphic Novels and Comics: Breathe life into static panels with Story Diffusion. Generate visuals that showcase dynamic action sequences and character emotions, enhancing the reading experience.
Interactive Storytelling: Integrate Story Diffusion into interactive storytelling platforms. Users can shape the narrative, and the model generates corresponding visuals on the fly, creating a truly personalized and engaging experience.