File size: 1,243 Bytes
0ce5bfb
570d38b
 
 
 
0ce5bfb
 
 
 
570d38b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0ce5bfb
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
---
title: FastAPI with Hugging Face
emoji: 🤗
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
---

# FastAPI with Hugging Face Transformers

This Space provides a FastAPI-based API for text processing using Hugging Face Transformers.

## Features

- **Sentiment Analysis**: Analyze the sentiment of text
- **Text Generation**: Generate text based on prompts
- **RESTful API**: Clean API endpoints with automatic documentation

## API Endpoints

- `GET /` - Health check
- `POST /sentiment` - Sentiment analysis
- `POST /generate` - Text generation  
- `GET /models` - Available models info
- `GET /docs` - API documentation (Swagger UI)

## Usage

### Sentiment Analysis
```bash
curl -X POST "https://your-space-name.hf.space/sentiment" \
     -H "Content-Type: application/json" \
     -d '{"text": "I love this product!"}'
```

### Text Generation
```bash
curl -X POST "https://your-space-name.hf.space/generate" \
     -H "Content-Type: application/json" \
     -d '{"text": "Once upon a time", "max_length": 50}'
```

## Interactive Documentation

Visit `https://your-space-name.hf.space/docs` for interactive API documentation.

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