Update README.md
Browse files
README.md
CHANGED
@@ -1,10 +1,48 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
---
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: FastAPI with Hugging Face
|
3 |
+
emoji: 🤗
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: green
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
---
|
9 |
|
10 |
+
# FastAPI with Hugging Face Transformers
|
11 |
+
|
12 |
+
This Space provides a FastAPI-based API for text processing using Hugging Face Transformers.
|
13 |
+
|
14 |
+
## Features
|
15 |
+
|
16 |
+
- **Sentiment Analysis**: Analyze the sentiment of text
|
17 |
+
- **Text Generation**: Generate text based on prompts
|
18 |
+
- **RESTful API**: Clean API endpoints with automatic documentation
|
19 |
+
|
20 |
+
## API Endpoints
|
21 |
+
|
22 |
+
- `GET /` - Health check
|
23 |
+
- `POST /sentiment` - Sentiment analysis
|
24 |
+
- `POST /generate` - Text generation
|
25 |
+
- `GET /models` - Available models info
|
26 |
+
- `GET /docs` - API documentation (Swagger UI)
|
27 |
+
|
28 |
+
## Usage
|
29 |
+
|
30 |
+
### Sentiment Analysis
|
31 |
+
```bash
|
32 |
+
curl -X POST "https://your-space-name.hf.space/sentiment" \
|
33 |
+
-H "Content-Type: application/json" \
|
34 |
+
-d '{"text": "I love this product!"}'
|
35 |
+
```
|
36 |
+
|
37 |
+
### Text Generation
|
38 |
+
```bash
|
39 |
+
curl -X POST "https://your-space-name.hf.space/generate" \
|
40 |
+
-H "Content-Type: application/json" \
|
41 |
+
-d '{"text": "Once upon a time", "max_length": 50}'
|
42 |
+
```
|
43 |
+
|
44 |
+
## Interactive Documentation
|
45 |
+
|
46 |
+
Visit `https://your-space-name.hf.space/docs` for interactive API documentation.
|
47 |
+
|
48 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|