File size: 1,756 Bytes
ba6139e
 
 
 
6740fa2
ba6139e
 
 
 
 
 
 
 
 
 
 
 
 
9fcb47f
ba6139e
 
 
6740fa2
9fcb47f
 
6740fa2
ba6139e
 
9fcb47f
 
6740fa2
ba6139e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

---
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