-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prodia: unified SDXL support, with model list, priority, advanced set…
…tings, resolution, default to R.V.5
- Loading branch information
Showing
6 changed files
with
279 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,50 @@ | ||
import { apiAsync } from '~/common/util/trpc.client'; | ||
|
||
import { useProdiaStore } from './store-prodia'; | ||
|
||
|
||
export const requireUserKeyProdia = !process.env.HAS_SERVER_KEY_PRODIA; | ||
|
||
export const canUseProdia = (): boolean => !!useProdiaStore.getState().prodiaModelId || !requireUserKeyProdia; | ||
|
||
export const isValidProdiaApiKey = (apiKey?: string) => !!apiKey && apiKey.trim()?.length >= 36; | ||
|
||
export const CmdRunProdia: string[] = ['/imagine', '/img']; | ||
|
||
|
||
export async function prodiaGenerateImage(count: number, imageText: string) { | ||
// use the most current model and settings | ||
const { | ||
prodiaApiKey: prodiaKey, prodiaModelId, prodiaModelGen, | ||
prodiaNegativePrompt: negativePrompt, prodiaSteps: steps, prodiaCfgScale: cfgScale, | ||
prodiaAspectRatio: aspectRatio, prodiaUpscale: upscale, | ||
prodiaResolution: resolution, | ||
prodiaSeed: seed, | ||
} = useProdiaStore.getState(); | ||
|
||
// Run the image generation 'count' times in parallel | ||
const imageUrls: string[] = await Promise.all( | ||
// using an array of 'count' number of promises | ||
Array(count).fill(undefined).map(async () => { | ||
|
||
const { imageUrl } = await apiAsync.prodia.imagine.query({ | ||
...(!!prodiaKey && { prodiaKey }), | ||
prodiaModel: prodiaModelId || 'Realistic_Vision_V5.0.safetensors [614d1063]', // data versioning fix | ||
prodiaGen: prodiaModelGen || 'sd', // data versioning fix | ||
prompt: imageText, | ||
...(!!negativePrompt && { negativePrompt }), | ||
...(!!steps && { steps }), | ||
...(!!cfgScale && { cfgScale }), | ||
...(!!aspectRatio && aspectRatio !== 'square' && { aspectRatio }), | ||
...(upscale && { upscale }), | ||
...(!!resolution && { resolution }), | ||
...(!!seed && { seed }), | ||
}); | ||
|
||
return imageUrl; | ||
}), | ||
); | ||
|
||
// Return the resulting image URLs | ||
return imageUrls; | ||
} |
Oops, something went wrong.
a8839b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
big-agi – ./
big-agi-enricoros.vercel.app
big-agi-git-main-enricoros.vercel.app
get.big-agi.com