Skip to content

Commit f5621d0

Browse files
committed
readme
1 parent 9a89288 commit f5621d0

4 files changed

Lines changed: 95 additions & 23 deletions

File tree

.idea/sentimental_analyses.iml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10-slim
1+
FROM python:3.11.11-slim
22
RUN apt-get update && apt-get install -y procps git
33
LABEL authors="shift"
44
WORKDIR /app
@@ -11,4 +11,4 @@ COPY supervisord.conf .
1111
EXPOSE 5000
1212
EXPOSE 5001
1313

14-
ENTRYPOINT ["./entrypoint.sh"]
14+
ENTRYPOINT ["./entrypoint.sh"]

README.md

Lines changed: 67 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Sentimental analyses with MLFLOW and models Wrappers
22

3+
[![version](https://img.shields.io/badge/version-1.0.0-green.svg)](https://semver.org)
4+
5+
## Table of content
6+
- [Overview](#overview)
7+
- [Architecture](#architecture)
8+
- [Install](#install)
9+
- [Usage](#usage)
10+
- [Contributing](#contributing)
11+
- [Production](#production)
12+
- [Monitoring](#monitoring)
13+
- [Api](#api)
14+
- [License](#license)
15+
- [Author](#author)
16+
- [Thanks](#thanks)
17+
18+
## Overview
19+
320
Tweet sentimental analyses with different models.
421

522
Four wrapper of models:
@@ -15,18 +32,7 @@ MLFlow is used to list all experiments and easily commpare results for several d
1532
Optuna is used to optimise parameters. It run a set of experiments with a variation of parameters and select the best configuration
1633
maximising the accuracy.
1734

18-
19-
20-
The app is dockerised and can be installed launching the command
21-
```bash
22-
docker compose up
23-
```
24-
or to run in background
25-
```bash
26-
docker compose up -d
27-
```
28-
29-
## Access and architecture
35+
## Architecture
3036
The application contains alerting system and monitoring on grafana on port 3000
3137
APP PORT
3238
MLFLOW 5001
@@ -42,15 +48,36 @@ Prometheus send metrics as the number of prediction running.
4248
An alert is send by mail when number of predictions in concurrency are up to 5.
4349
An alert is send when the result of the prediction is too bad, probability < 0.5.
4450

45-
## Installation in dev
46-
# Install uv (Rust package to fastly install package)
51+
52+
## Install
53+
54+
The app is dockerised and can be installed launching the command
55+
```bash
56+
docker compose up
57+
```
58+
or to run in background
59+
```bash
60+
docker compose up -d
61+
```
62+
63+
64+
## Contributing
65+
#### Install uv (Rust package to fastly install package)
4766
```bash
4867
curl -Ls https://astral.sh/uv/install.sh | bash
4968
export PATH="$HOME/.cargo/bin:$PATH"
5069
```
70+
#### Source the code in the container
71+
Modify the docker-compose.yaml to add the source code as volume
72+
```bash
73+
volumes:
74+
- ./src:/app/src/
75+
- ./mlruns:/app/mlruns/
76+
```
5177

52-
## OVH Train with AI train
78+
## Usage
5379

80+
### OVH Train with AI train
5481
Create an object storage on OVH managed with ovhai cli
5582
The secret key is obtain clicking on the user object storage line 'access secret key'
5683
```bash
@@ -65,7 +92,7 @@ Credentials are stored in ~/.config/ovhai/context.json
6592
uv pip install boto3 awscli ovhai
6693
```
6794

68-
## Run on multi GPU
95+
### Run on multi GPU
6996
DEBUG
7097
```bash
7198
export TORCH_DISTRIBUTED_DEBUG=DETAIL
@@ -74,16 +101,36 @@ export TORCH_DISTRIBUTED_DEBUG=DETAIL
74101
python -m torch.distributed.run --nproc_per_node=2 train.py
75102
```
76103

77-
## Tests
104+
### Tests
78105
```bash
79106
pytest src/tests
80107
```
81108

82-
## Launch a test to verify the prection from the API
109+
### Launch a test to verify the prection from the API
83110
Go on 127.0.0.1:5000, tap your tweet and click on predict button
84111

85-
Par requête http
112+
113+
## Production
114+
An exemple deployment is available on https://tweetsentiment.shift.python.software.fr
115+
116+
## Monitoring
117+
Add alert and monitoring and dashboard on grafana on your local instance
118+
and save them in grafana folder.
119+
Reload grafana and they will be available on http://localhost:3000 as provisionning templates
120+
121+
## Api
122+
You can contact the api example
123+
or change the url on the script predict_client.py to test your instance
86124
```bash
87125
export $(cat .env | xargs)
88-
python post.py
126+
python predict_client.py
89127
```
128+
## License
129+
130+
MIT License
131+
132+
## Author
133+
Shift python software
134+
135+
## Thanks
136+
Thanks to all contributors

templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ <h2 class="text-justify m-2"> Bienvenue Sur TweetSentimentPredict </h2>
4747
body: JSON.stringify(payload)
4848
}).then(res => res.json()).then(res => {
4949
button.disabled = true;
50-
ws = new WebSocket("ws://127.0.0.1:5000/ws/" + res.task_id)
50+
ws = new WebSocket(`ws://${window.location.host}/ws/` + res.task_id)
5151
ws.onmessage = (event) => {
5252
const element = document.getElementById("result")
5353
const payload = JSON.parse(event.data)

0 commit comments

Comments
 (0)