Spaces:
Sleeping
Sleeping
usmansafdarktk
commited on
Commit
·
e6bdf49
1
Parent(s):
f52fd48
Updaed README according to new end points
Browse files
README.md
CHANGED
@@ -7,8 +7,18 @@ sdk: docker
|
|
7 |
app_file: main.py
|
8 |
pinned: false
|
9 |
---
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
## Installation
|
13 |
|
14 |
Clone the repository:
|
@@ -29,15 +39,22 @@ Run the API locally:
|
|
29 |
uvicorn main:app --host 0.0.0.0 --port 7860
|
30 |
```
|
31 |
|
32 |
-
|
33 |
## Usage
|
34 |
-
```
|
35 |
-
Endpoint: POST /generate
|
36 |
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
Request Body (JSON):
|
|
|
39 |
{
|
40 |
-
"
|
41 |
"max_length": 100,
|
42 |
"temperature": 1.0,
|
43 |
"top_p": 0.9
|
@@ -45,18 +62,40 @@ Request Body (JSON):
|
|
45 |
```
|
46 |
|
47 |
Response:
|
48 |
-
```
|
49 |
{
|
50 |
-
"generated_text": "
|
51 |
}
|
52 |
```
|
53 |
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
## Deployment
|
58 |
-
|
|
|
|
|
59 |
## License
|
|
|
60 |
The LaMini-GPT-774M model is licensed under CC BY-NC 4.0 (non-commercial use only). Ensure compliance when using this API.
|
|
|
61 |
## Contributing
|
62 |
-
|
|
|
|
7 |
app_file: main.py
|
8 |
pinned: false
|
9 |
---
|
10 |
+
|
11 |
+
# LaMini-LM API
|
12 |
+
|
13 |
+
This is a FastAPI-based API for text generation using the MBZUAI/LaMini-GPT-774M model from the LaMini-LM series. It features a web interface for easy interaction and a REST API for programmatic access.
|
14 |
+
|
15 |
+
## Features
|
16 |
+
|
17 |
+
- **Web Interface**: User-friendly UI accessible at the root URL
|
18 |
+
- **REST API**: Programmatic access via `/api/generate` endpoint
|
19 |
+
- **Model**: MBZUAI/LaMini-GPT-774M for high-quality text generation
|
20 |
+
- **Configurable Parameters**: Control max length, temperature, and top-p sampling
|
21 |
+
|
22 |
## Installation
|
23 |
|
24 |
Clone the repository:
|
|
|
39 |
uvicorn main:app --host 0.0.0.0 --port 7860
|
40 |
```
|
41 |
|
|
|
42 |
## Usage
|
|
|
|
|
43 |
|
44 |
+
### Web Interface
|
45 |
+
Simply visit the root URL to access the interactive web interface where you can:
|
46 |
+
- Enter text instructions
|
47 |
+
- Adjust generation parameters (max length, temperature, top-p)
|
48 |
+
- Generate text with a single click
|
49 |
+
|
50 |
+
### API Endpoints
|
51 |
+
|
52 |
+
**Generate Text**: `POST /api/generate`
|
53 |
+
|
54 |
Request Body (JSON):
|
55 |
+
```json
|
56 |
{
|
57 |
+
"instruction": "Tell me about camels",
|
58 |
"max_length": 100,
|
59 |
"temperature": 1.0,
|
60 |
"top_p": 0.9
|
|
|
62 |
```
|
63 |
|
64 |
Response:
|
65 |
+
```json
|
66 |
{
|
67 |
+
"generated_text": "Camels are remarkable desert animals known for their ability to survive in harsh conditions. These fascinating creatures have evolved unique adaptations including their iconic humps, which store fat rather than water. Camels can go for extended periods without drinking water, making them invaluable companions for desert travelers throughout history."
|
68 |
}
|
69 |
```
|
70 |
|
71 |
+
**Health Check**: `GET /api/health`
|
72 |
+
```json
|
73 |
+
{
|
74 |
+
"status": "healthy"
|
75 |
+
}
|
76 |
+
```
|
77 |
+
|
78 |
+
**API Info**: `GET /api`
|
79 |
+
```json
|
80 |
+
{
|
81 |
+
"message": "Welcome to the LaMini-LM API. Use POST /generate to generate text."
|
82 |
+
}
|
83 |
+
```
|
84 |
|
85 |
+
### Parameter Constraints
|
86 |
+
- `instruction`: Required, non-empty string
|
87 |
+
- `max_length`: 10-500 tokens (default: 100)
|
88 |
+
- `temperature`: 0.1-2.0 (default: 1.0)
|
89 |
+
- `top_p`: 0.1-1.0 (default: 0.9)
|
90 |
|
91 |
## Deployment
|
92 |
+
|
93 |
+
This API is designed to be deployed on Hugging Face Spaces using Docker. The Dockerfile handles all dependencies and model loading automatically.
|
94 |
+
|
95 |
## License
|
96 |
+
|
97 |
The LaMini-GPT-774M model is licensed under CC BY-NC 4.0 (non-commercial use only). Ensure compliance when using this API.
|
98 |
+
|
99 |
## Contributing
|
100 |
+
|
101 |
+
This project is a community contribution. If you're from MBZUAI, feel free to adopt this Hugging Face Space! Contact for details.
|