Nightfury16 commited on
Commit
0347036
Β·
1 Parent(s): 2e13826

Initial commit: Dockerized SVM classifier with FastAPI and Gradio UI.

Browse files
Files changed (1) hide show
  1. READMe.md +0 -61
READMe.md DELETED
@@ -1,61 +0,0 @@
1
- ---
2
- title: STOP
3
- sdk: docker
4
- app_port: 7860
5
- colorFrom: red
6
- colorTo: indigo
7
- description: STOP/NOT_STOP text classification using Linear SVM deployed with FastAPI and Docker.
8
- ---
9
-
10
- # STOP Classifier API
11
-
12
- This Hugging Face Space hosts a low-latency text classification service deployed with Docker and FastAPI.
13
-
14
- The service uses a highly efficient Linear Support Vector Machine (SVM) model trained on text features extracted via TF-IDF to classify messages as either intending to end communication (`STOP`) or not (`NOT_STOP`). As confirmed by the training script, the SVM model provides millisecond-level inference, which is ideal for the required low-latency API.
15
-
16
- ## Project Structure
17
-
18
- The deployment uses the following structure:
19
-
20
- ```
21
- .
22
- β”œβ”€β”€ app.py
23
- β”œβ”€β”€ Dockerfile
24
- β”œβ”€β”€ requirements.txt
25
- β”œβ”€β”€ README.md
26
- └── checkpoint/
27
- β”œβ”€β”€ tfidf_vectorizer.pkl
28
- └── svm_stop_classifier.pkl
29
- ```
30
-
31
- ## API Endpoints
32
-
33
- The FastAPI application provides two primary endpoints for prediction:
34
-
35
- ### 1. Health Check (GET)
36
-
37
- * **Path:** `/`
38
- * **Method:** `GET`
39
- * **Description:** A simple endpoint to confirm the service is running and the models are loaded.
40
-
41
- ### 2. Single Prediction (GET)
42
-
43
- * **Path:** `/predict?text=<your_text>`
44
- * **Method:** `GET`
45
- * **Description:** Classifies a single text string passed as a query parameter. This is suitable for quick, individual queries.
46
- * **Example Query:** `/predict?text=please%20discontinue%20all%20contact`
47
-
48
- ### 3. Batch Prediction (POST)
49
-
50
- * **Path:** `/predict`
51
- * **Method:** `POST`
52
- * **Description:** Classifies a list of text strings in a single request. This is the recommended approach for high-throughput, low-latency production use cases due to reduced overhead.
53
- * **Request Body (JSON):**
54
-
55
- ```json
56
- {
57
- "texts": [
58
- "do not ever text me again",
59
- "I will stop by your office tomorrow"
60
- ]
61
- }