AONWEB
aonweb - JavaScript sdk for AON
- API version: 1.0.0
- Package version: 1.0.14
Installation
For Node.js
npm
Install it from npm:
npm install aonweb --save
Getting Started
Please follow the installation instruction and execute the following JS code:
import { AI, AIOptions, User } from 'aonweb'
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function prediction() {
let user = new User()
let is_login = await user.islogin()
if (!is_login) {
for (let i = 0; i < 10; i++) {
let result = await user.getOwnedUsers()
let userid = result && result._userIds && result._userIds.length && result._userIds[0]
if (userid && userid.length) {
break
}
await sleep(300)
}
is_login = await user.islogin()
if (!is_login) {
console.log("login failed,please try again later");
return
}
}
const ai_options = new AIOptions({
appId: REPLACE_APP_ID //replace app id
})
let price = 10
const ai = new AI(ai_options)
let response = await ai.prediction("/predictions/ai/stable-diffusion-3",
{
input:{
"prompt": "with smoke, half ice and half fire and ultra realistic in detail.wolf, typography, dark fantasy, wildlife photography, vibrant, cinematic and on a black background",
"cfg": 3.5,
"steps": 28,
"aspect_ratio": "9:16",
"output_format": "png",
"output_quality": 90,
"negative_prompt": "",
"prompt_strength": 0.85
}
},price);
if (response && response.code == 200 && response.data) {
response = response.data
}
if (response.task.exec_code == 200 && response.task.is_success) {
console.log("test",response.output);
}
}
prediction();
Constructor
name | type | Description |
---|---|---|
appId | string | Required. |
2.0.4
1 year ago
2.0.3
1 year ago
2.0.2
1 year ago
2.0.1
1 year ago
2.0.0
1 year ago
1.0.18
1 year ago
1.0.17
1 year ago
1.0.15
1 year ago
1.0.14
1 year ago
1.0.2
1 year ago
1.0.1
1 year ago
1.0.0
1 year ago
1.0.9
1 year ago
1.0.8
1 year ago
1.0.7
1 year ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.4
1 year ago
1.0.3
1 year ago
1.0.11
1 year ago
0.0.9
1 year ago
1.0.10
1 year ago
0.0.8
1 year ago
0.0.5
1 year ago
0.0.4
1 year ago
1.0.13
1 year ago
0.0.7
1 year ago
1.0.12
1 year ago
0.0.6
1 year ago
0.0.2
1 year ago
0.0.1
1 year ago
0.0.0
1 year ago