Compare commits
No commits in common. "9cc2dfd754b267e39fc5588f63a74e7e4bffcd48" and "ed13a48f12baa4acf3e2298314a9b4926838c57d" have entirely different histories.
9cc2dfd754
...
ed13a48f12
|
|
@ -1,3 +1,3 @@
|
|||
index.js
|
||||
node_modules
|
||||
/sdxl.gen.json
|
||||
sdxl.gen.json
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ program
|
|||
.description('generate an image with sdxl')
|
||||
.argument('[config]', 'path to the config json', './sdxl.gen.json')
|
||||
.option('--init', 'create a default sdxl.gen.json')
|
||||
.option('--append [where]', 'saves generated url to a text file', './generated.txt')
|
||||
.option('--append [where]', 'saves generated url to a text file')
|
||||
.option('--queue [amount]', 'queues jobs without waiting for them')
|
||||
.action(async (config, flags) => {
|
||||
if (flags.init) {
|
||||
|
|
@ -37,10 +37,11 @@ program
|
|||
for (let i = 0; i < queue; i++) {
|
||||
console.log(`Fetching ${i + 1}/${queue}...`);
|
||||
const job = await fetchProdia(json);
|
||||
const url = `https://images.prodia.xyz/${job.job}.png`;
|
||||
if (flags.append)
|
||||
await fs.appendFile(flags.append, url + '\n');
|
||||
console.log(url);
|
||||
await fs.appendFile(
|
||||
flags.append,
|
||||
`https://images.prodia.xyz/${job.job}.png\n`
|
||||
);
|
||||
}
|
||||
console.log('Done!');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import fetch from 'node-fetch';
|
||||
import * as fs from 'fs/promises';
|
||||
|
||||
type ProdiaParams = {
|
||||
model: string;
|
||||
|
|
@ -12,12 +11,6 @@ type ProdiaParams = {
|
|||
sampler: string;
|
||||
width: number;
|
||||
height: number;
|
||||
|
||||
// transform params
|
||||
denoising_strength: number;
|
||||
upscale: boolean;
|
||||
input_image?: string;
|
||||
imageData?: string;
|
||||
};
|
||||
|
||||
type ProdiaResponse = {
|
||||
|
|
@ -37,20 +30,12 @@ export const defaultProdiaParams: ProdiaParams = {
|
|||
sampler: 'DPM++ 2M Karras',
|
||||
width: 1024,
|
||||
height: 1024,
|
||||
|
||||
denoising_strength: 0.7,
|
||||
upscale: false,
|
||||
};
|
||||
|
||||
export async function fetchProdia(
|
||||
params: Partial<ProdiaParams>,
|
||||
endpoint = 'sdxl/generate'
|
||||
) {
|
||||
if(params.input_image){
|
||||
const data = await fs.readFile(params.input_image);
|
||||
params.imageData = data.toString('base64');
|
||||
delete params.input_image;
|
||||
}
|
||||
const resp = await fetch(`https://api.prodia.com/v1/${endpoint}`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue