ADK09's picture
Initial Commit
5c50bbf
---
title: Speak Your Mind Fastapi
emoji: 🔥
colorFrom: gray
colorTo: green
sdk: docker
pinned: false
license: mit
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
# Speak Your Mind FastAPI
**Speak Your Mind** is an **emotion detection API** built with **FastAPI**.
It uses the **pre-trained RoBERTa model** [`cardiffnlp/twitter-roberta-base-emotion-latest`](https://huggingface.co/cardiffnlp/twitter-roberta-base-emotion-latest) to analyze emotions from text.
## Features
- **FastAPI-based REST API** running on **port 7860**.
- Uses **pre-trained RoBERTa model** for emotion classification.
- **Dockerized for easy deployment**.
## Model Information
This API uses the **`cardiffnlp/twitter-roberta-base-emotion-latest`** model without any additional training or fine-tuning.
It predicts emotions such as **joy, sadness, optimism, and more**.
- **Model Source:** [Hugging Face Model Page](https://huggingface.co/cardiffnlp/twitter-roberta-base-emotion-latest)
- **No additional fine-tuning or training has been done**.
- **Supported Emotions:** Joy, Sadness, Optimism, etc.
## 🛠️ Installation & Usage
### ▶ Run Locally
```bash
git clone https://huggingface.co/spaces/ADK09/speak-your-mind-fastapi
cd speak-your-mind-fastapi
pip install -r requirements.txt
uvicorn app:app --host 0.0.0.0 --port 7860
```
Access the API at `http://localhost:7860/docs`
### ▶ Run with Docker
```bash
docker build -t speak-your-mind .
docker run -p 7860:7860 speak-your-mind
```
## API Endpoints
| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/` | Check if API is running |
| `POST` | `/classify-emotion` | Predict emotion from text |
### Example Request
```json
{
"text": "I feel fantastic today!"
}
```
### Example Response
```json
{
"predicted_emotion": "joy"
}
```
## Disclaimer
This API **only uses the pre-trained model** and does not modify or fine-tune it.
Predictions are based on the **original model's training data**
## License
This project is licensed under the **MIT License**.
## Acknowledgments
This project **uses the RoBERTa model fine-tuned by Cardiff NLP**.
Special thanks to the **Hugging Face** and **Cardiff NLP teams**.
- [`cardiffnlp/twitter-roberta-base-emotion-latest`](https://huggingface.co/cardiffnlp/twitter-roberta-base-emotion-latest)
```