aliriaz2k16 commited on
Commit
d019fdf
1 Parent(s): 6abe250

Update README.Docker.md

Browse files
Files changed (1) hide show
  1. README.Docker.md +51 -44
README.Docker.md CHANGED
@@ -1,58 +1,65 @@
1
- Text Classification API
2
- FastAPI, Docker, and Hugging Face Transformers
3
  This API provides text classification capabilities using a pre-trained model for sentiment analysis. It allows users to analyze the sentiment of text inputs and obtain the corresponding sentiment labels.
 
 
 
 
4
 
5
- The API has been built using the Hugging Face transformers library.
6
- It uses the following pre-trained transformer model from Hugging Face:
7
- cardiffnlp/twitter-roberta-base-sentiment-latest
8
- It classifies the text as positive, negative, or neutral.
9
- Table of Contents
10
- Text Classification API
11
- Table of Contents
12
- Introduction
13
- Installation
14
- Usage
15
- Documentation
16
- Building and Running the Docker Container
17
- Interacting with the API
18
- Acknowledgments
19
- License
20
- Introduction
21
  This API is built using FastAPI and leverages a pre-trained sentiment analysis model from the Hugging Face model hub. It preprocesses the input text and passes it through the model to classify the sentiment as positive, negative, or neutral.
22
 
23
- Installation
24
  To install and run the API locally, follow these steps:
25
 
26
- Clone this repository to your local machine.
27
- Ensure you have Docker installed.
28
- Change the port to 8000 in the Dockerfile.
29
- Build the Docker container using the provided Dockerfile.
30
- Run the Docker container.
31
- Usage
 
32
  To use the API, send HTTP requests to the appropriate endpoints. The API provides the following endpoints:
33
 
34
- GET /: Welcome endpoint, returns a greeting message.
35
- POST /analyze/{text}: Analyze endpoint, classifies the sentiment of the provided text.
36
- Documentation
 
37
  The API is documented using FastAPI's automatic documentation features. You can access the API documentation using the Swagger UI or ReDoc interface. Simply navigate to the appropriate URL after starting the API server.
38
 
39
- Swagger UI http://localhost:8000/docs
40
- ReDoc http://localhost:8000/redoc
41
- Building and Running the Docker Container
42
- To build and run the Docker container, follow these steps:
43
 
44
- Navigate to the folder in which your FastAPI app resides.
45
- Build a Docker image using the following command
46
- docker build -t text-classification-api .
47
- Containerize the application by creating a Docker container from the built image
48
- docker run -d -p 8000:8000 text-classification-api
49
- The API will be available at http://localhost:8000
50
- The API documentaion will be avaialable at http://localhost:8000/docs or http://localhost:8000/redoc
51
- Interacting with the API
 
 
 
 
 
 
 
52
  Once the API is running, you can interact with it using HTTP requests.
53
-
54
- Acknowledgments
55
  This API was built with inspiration from various open-source projects and libraries. Special thanks to the developers and contributors of FastAPI, Hugging Face Transformers, and NLTK.
56
 
57
- License
58
- This project is licensed under the Apache license version 2.0.
 
1
+ # Text Classification API
2
+ **FastAPI, Docker, and Hugging Face Transformers**\
3
  This API provides text classification capabilities using a pre-trained model for sentiment analysis. It allows users to analyze the sentiment of text inputs and obtain the corresponding sentiment labels.
4
+ - The API has been built using the Hugging Face `transformers` library.
5
+ - It uses the following pre-trained transformer model from Hugging Face:
6
+ - `cardiffnlp/twitter-roberta-base-sentiment-latest`
7
+ - It classifies the text as `positive`, `negative`, or `neutral`.
8
 
9
+ ## Table of Contents
10
+ - [Text Classification API](#text-classification-api)
11
+ - [Table of Contents](#table-of-contents)
12
+ - [Introduction](#introduction)
13
+ - [Installation](#installation)
14
+ - [Usage](#usage)
15
+ - [Documentation](#documentation)
16
+ - [Building and Running the Docker Container](#building-and-running-the-docker-container)
17
+ - [Interacting with the API](#interacting-with-the-api)
18
+ - [Acknowledgments](#acknowledgments)
19
+ - [License](#license)
20
+
21
+ ## Introduction
 
 
 
22
  This API is built using FastAPI and leverages a pre-trained sentiment analysis model from the Hugging Face model hub. It preprocesses the input text and passes it through the model to classify the sentiment as positive, negative, or neutral.
23
 
24
+ ## Installation
25
  To install and run the API locally, follow these steps:
26
 
27
+ 1. Clone this repository to your local machine.
28
+ 2. Ensure you have Docker installed.
29
+ 3. Change the port to 8000 in the Dockerfile.
30
+ 4. Build the Docker container using the provided Dockerfile.
31
+ 5. Run the Docker container.
32
+
33
+ ## Usage
34
  To use the API, send HTTP requests to the appropriate endpoints. The API provides the following endpoints:
35
 
36
+ - `GET /`: Welcome endpoint, returns a greeting message.
37
+ - `POST /analyze/{text}`: Analyze endpoint, classifies the sentiment of the provided text.
38
+
39
+ ## Documentation
40
  The API is documented using FastAPI's automatic documentation features. You can access the API documentation using the Swagger UI or ReDoc interface. Simply navigate to the appropriate URL after starting the API server.
41
 
42
+ - **Swagger UI** `http://localhost:8000/docs`
43
+ - **ReDoc** `http://localhost:8000/redoc`
 
 
44
 
45
+ ## Building and Running the Docker Container
46
+ To build and run the Docker container, follow these steps:
47
+ 1. Navigate to the folder in which your FastAPI app resides.
48
+ 2. Build a Docker image using the following command
49
+ ```
50
+ docker build -t text-classification-api .
51
+ ```
52
+ 3. Containerize the application by creating a Docker container from the built image
53
+ ```
54
+ docker run -d -p 8000:8000 text-classification-api
55
+ ```
56
+ 4. The API will be available at `http://localhost:8000`
57
+ 5. The API documentaion will be avaialable at `http://localhost:8000/docs` or `http://localhost:8000/redoc`
58
+
59
+ ## Interacting with the API
60
  Once the API is running, you can interact with it using HTTP requests.
61
+ ## Acknowledgments
 
62
  This API was built with inspiration from various open-source projects and libraries. Special thanks to the developers and contributors of FastAPI, Hugging Face Transformers, and NLTK.
63
 
64
+ ## License
65
+ This project is licensed under the [Apache license version 2.0](LICENSE).