--- language: en license: mit library_name: diffusers tags: - stable-diffusion - text-to-image - image-generation inference: true model-index: - name: Stable Diffusion Image Generator results: - task: name: Text-to-Image type: text-to-image dataset: name: LAION-400M type: image metrics: - name: Inception Score type: inception_score value: 9.0 - name: FID type: fid value: 25.0 --- # Stable Diffusion Image Generator with Inception Score This repository uses the `Stable Diffusion` model from the `diffusers` library to generate images based on a text prompt and returns the generated image in base64 format. ## How It Works 1. The user sends a prompt (e.g., "A red apple on a wooden table"). 2. The `Stable Diffusion` model generates images based on the provided prompt. 3. The first generated image is returned as a base64-encoded PNG image. ## Model Used - **Model**: `CompVis/stable-diffusion-v1-4` - **Library**: [diffusers](https://huggingface.co/docs/diffusers) - The model is pre-trained, and inference is run on a GPU (if available) or CPU. ## How to Use the Inference API You can use this model via the Hugging Face Inference API by making a POST request with the following format: ```bash curl -X POST https://api-inference.huggingface.co/models/YOUR_USERNAME/stable-diffusion-make -H "Authorization: Bearer YOUR_API_TOKEN" -H "Content-Type: application/json" -d '{"prompt": "A red apple on a wooden table", "num_images": 1}' ``` ### Parameters: - `prompt`: The text prompt for image generation. - `num_images`: Number of images to generate (default is 1). The response will return the first image encoded in base64 format. ## License MIT License