Tasks
Image Generation
Model API
- Welcome
- Get started
- Understand the API
- Tasks
- Audio Classification
- Automatic Speech Recognition
- Chat
- Depth Estimation
- Document Question Answering
- Feature Extraction
- Fill Mask
- Image Classification
- Image Feature Extraction
- Image Segmentation
- Image-to-Text
- Mask Generation
- Object Detection
- Question Answering
- Sentence Similarity
- Summarization
- Text Classification
- Text Generation
- Image Generation
- Text-to-Speech
- Text-to-Text Generation
- Text-to-Video
- Token Classification
- Translation
- Unconditional Image Generation
- Video Classification
- Visual Question Answering
- Zero Shot Classification
- Zero Shot Image Classification
- Zero Shot Object Detection
Tasks
Image Generation
Generate images using text
import Bytez from "bytez.js";
const sdk = new Bytez("BYTEZ_KEY");
const model = sdk.model("dreamlike-art/dreamlike-photoreal-2.0");
await model.create()
const { error, output } = await model.run("A beautiful landscape with mountains and a river");
console.log({ error, output });
Instead receiving an image in JSON format, you opt to stream back the data URL:
import Bytez from "bytez.js";
const sdk = new Bytez("BYTEZ_KEY");
const model = sdk.model("dreamlike-art/dreamlike-photoreal-2.0");
await model.create()
const text = "A beautiful landscape with mountains and a river"
const stream = true
const readStream = await model.run(text, stream);
// the stream returns the base64 data url
for await (const chunk of readStream) {
console.log(chunk)
}