A backend server for multilevel AI imaging.
- Download pretrained text to image model from huggingface in subdirectory:
git clone https://huggingface.co/prompthero/openjourney-v4 - Download pretrained prompt generation model from huggingface in subdirectory:
git clone https://huggingface.co/FredZhang7/distilgpt2-stable-diffusion-v2 - Download tokenizer from huggingface in subdirectory:
git clone https://huggingface.co/distilgpt2 - Download pretrained sentence similarity model from huggingface in subdirectory:
git clone https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2
- Execute command:
python start_api.py
\image_gen: Generate an image using the AI text-to-image model. Returns a png object in bytes form.prompt(required): input text for image generation modelheight: height of image in pixelswidth: width of image in pixelsnum_inference_steps: number of denoising stepsguidance_scale: guidance scalenegative_prompt: prompts to avoid in image generationnum_images_per_prompt: number of images to return
\image_upscale: Upscale an image using the AI upscaler model. Returns a png object in bytes form.url(required): location of input image for upscaler modelprompt(required): input text for upscaler modelnum_inference_stepsguidance_scalenegative_promptnum_images_per_prompt
\text_gen: Improve a prompt using the AI text generation model. Returns a string.prompt(required): input text for text generation modeltemperature: diversity of prompt resultstop_k: number of tokens to sample at each stepmax_length: maximum number of output tokensrepetition_penalty: penalty value for token repetitionnum_return_sequences: number of prompts to return