Update README.md
Browse files
README.md
CHANGED
@@ -1,10 +1,104 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
|
|
|
1 |
+
# Multi-Model API Space
|
2 |
+
|
3 |
+
This Hugging Face Space provides API access to multiple Lyon28 models with both REST API and web interface.
|
4 |
+
|
5 |
+
## Available Models
|
6 |
+
|
7 |
+
- `Lyon28/Tinny-Llama` - Small language model
|
8 |
+
- `Lyon28/Pythia` - Pythia-based model
|
9 |
+
- `Lyon28/Bert-Tinny` - BERT variant
|
10 |
+
- `Lyon28/Albert-Base-V2` - ALBERT model
|
11 |
+
- `Lyon28/T5-Small` - T5 text-to-text model
|
12 |
+
- `Lyon28/GPT-2` - GPT-2 variant
|
13 |
+
- `Lyon28/GPT-Neo` - GPT-Neo model
|
14 |
+
- `Lyon28/Distilbert-Base-Uncased` - DistilBERT model
|
15 |
+
- `Lyon28/Distil_GPT-2` - Distilled GPT-2
|
16 |
+
- `Lyon28/GPT-2-Tinny` - Tiny GPT-2
|
17 |
+
- `Lyon28/Electra-Small` - ELECTRA model
|
18 |
+
|
19 |
+
## Features
|
20 |
+
|
21 |
+
### 🚀 REST API Endpoints
|
22 |
+
|
23 |
+
1. **GET /api/models** - List available and loaded models
|
24 |
+
2. **POST /api/load_model** - Load a specific model
|
25 |
+
3. **POST /api/generate** - Generate text using loaded models
|
26 |
+
4. **GET /health** - Health check
|
27 |
+
|
28 |
+
### 🎯 Web Interface
|
29 |
+
|
30 |
+
- Model management interface
|
31 |
+
- Interactive text generation
|
32 |
+
- Parameter tuning (temperature, top_p, max_length)
|
33 |
+
- Real-time model loading status
|
34 |
+
|
35 |
+
## API Usage
|
36 |
+
|
37 |
+
### Load a Model
|
38 |
+
```bash
|
39 |
+
curl -X POST "https://your-space-url/api/load_model" \
|
40 |
+
-H "Content-Type: application/json" \
|
41 |
+
-d '{"model_name": "Lyon28/GPT-2"}'
|
42 |
+
```
|
43 |
+
|
44 |
+
### Generate Text
|
45 |
+
```bash
|
46 |
+
curl -X POST "https://your-space-url/api/generate" \
|
47 |
+
-H "Content-Type: application/json" \
|
48 |
+
-d '{
|
49 |
+
"model_name": "Lyon28/GPT-2",
|
50 |
+
"prompt": "Hello world",
|
51 |
+
"max_length": 100,
|
52 |
+
"temperature": 0.7,
|
53 |
+
"top_p": 0.9
|
54 |
+
}'
|
55 |
+
```
|
56 |
+
|
57 |
+
### Python Example
|
58 |
+
```python
|
59 |
+
import requests
|
60 |
+
|
61 |
+
# Load model
|
62 |
+
response = requests.post("https://your-space-url/api/load_model",
|
63 |
+
json={"model_name": "Lyon28/GPT-2"})
|
64 |
+
|
65 |
+
# Generate text
|
66 |
+
response = requests.post("https://your-space-url/api/generate",
|
67 |
+
json={
|
68 |
+
"model_name": "Lyon28/GPT-2",
|
69 |
+
"prompt": "The future of AI is",
|
70 |
+
"max_length": 150,
|
71 |
+
"temperature": 0.8
|
72 |
+
})
|
73 |
+
|
74 |
+
result = response.json()
|
75 |
+
print(result["generated_text"])
|
76 |
+
```
|
77 |
+
|
78 |
+
## Model Types
|
79 |
+
|
80 |
+
- **Causal LM**: GPT-2, GPT-Neo, Pythia, Tinny-Llama variants
|
81 |
+
- **Text-to-Text**: T5-Small
|
82 |
+
- **Feature Extraction**: BERT, ALBERT, DistilBERT, ELECTRA
|
83 |
+
|
84 |
+
## Performance Notes
|
85 |
+
|
86 |
+
- Models are loaded on-demand to optimize memory usage
|
87 |
+
- GPU acceleration used when available
|
88 |
+
- Models cached for faster subsequent loads
|
89 |
+
- Support for both CPU and GPU inference
|
90 |
+
|
91 |
+
## Rate Limits
|
92 |
+
|
93 |
+
This is a free public API. Please use responsibly:
|
94 |
+
- Max 100 requests per minute per IP
|
95 |
+
- Max 500 tokens per generation
|
96 |
+
- Models auto-unload after 1 hour of inactivity
|
97 |
+
|
98 |
+
## Support
|
99 |
+
|
100 |
+
For issues or questions about specific Lyon28 models, please contact the model authors.
|
101 |
+
|
102 |
---
|
103 |
|
104 |
+
*Powered by Hugging Face Transformers and Gradio*
|