File size: 1,371 Bytes
83e2fd4
 
 
 
 
 
 
 
 
 
059dae2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Quotes
emoji: 🐨
colorFrom: pink
colorTo: green
sdk: docker
pinned: false
short_description: Quotes API Space
---

# Quotes API Space

This Hugging Face Space provides an API to fetch 50 random quotes from the [jstet/quotes-500k](https://huggingface.co/datasets/jstet/quotes-500k) dataset.

## Usage

Send a GET request to `/api/quotes` to retrieve 50 random quotes. Example response:

```json
{
  "quotes": [
    {"quote": "Life is what happens when you're busy making other plans.", "author": "John Lennon", "category": "Life"},
    ...
  ]
}
```

## Setup

This Space uses the Docker Space SDK with Python, FastAPI, and the Hugging Face `datasets` library. The configuration is defined in the following files:

- `Dockerfile`: Defines the Docker image.
- `requirements.txt`: Lists Python dependencies.
- `app.py`: Contains the FastAPI application code.

## Deployment

To deploy this Space on Hugging Face:

1. Create a new Space on Hugging Face, selecting the Docker template.
2. Upload the `Dockerfile`, `requirements.txt`, `app.py`, and `README.md` files to the Space repository.
3. Configure the Space to use the Docker Space SDK.
4. Build and deploy the Space.

The Space will be available at `https://<your-username>-<space-name>.hf.space/api/quotes`.

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference