Spaces:
Sleeping
Sleeping
Commit ·
131931c
0
Parent(s):
update
Browse files- .github/workflows/ci.yml +45 -0
- .huggingface.yml +8 -0
- Dockerfile +40 -0
- README.md +11 -0
- app.py +3 -0
- requirements.txt +9 -0
- scripts/deploy_model.sh +0 -0
- scripts/run_training.sh +0 -0
- scripts/update_data.sh +0 -0
.github/workflows/ci.yml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CI/CD Pipeline for Emotion Recognition
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- main
|
| 7 |
+
pull_request:
|
| 8 |
+
branches:
|
| 9 |
+
- main
|
| 10 |
+
|
| 11 |
+
jobs:
|
| 12 |
+
build:
|
| 13 |
+
runs-on: ubuntu-latest
|
| 14 |
+
|
| 15 |
+
steps:
|
| 16 |
+
- name: Checkout repository
|
| 17 |
+
uses: actions/checkout@v2
|
| 18 |
+
|
| 19 |
+
- name: Set up Python
|
| 20 |
+
uses: actions/setup-python@v2
|
| 21 |
+
with:
|
| 22 |
+
python-version: '3.9'
|
| 23 |
+
|
| 24 |
+
- name: Install dependencies
|
| 25 |
+
run: |
|
| 26 |
+
python -m pip install --upgrade pip
|
| 27 |
+
pip install -r requirements.txt
|
| 28 |
+
|
| 29 |
+
- name: Run tests
|
| 30 |
+
run: |
|
| 31 |
+
pytest --maxfail=1 --disable-warnings -q
|
| 32 |
+
|
| 33 |
+
- name: Train model
|
| 34 |
+
run: |
|
| 35 |
+
python src/models/train_model.py
|
| 36 |
+
|
| 37 |
+
- name: Upload trained model to Hugging Face (optional)
|
| 38 |
+
run: |
|
| 39 |
+
huggingface-cli login ${{ secrets.HUGGINGFACE_TOKEN }}
|
| 40 |
+
python src/models/upload_model.py
|
| 41 |
+
|
| 42 |
+
- name: Deploy to Hugging Face Space or other platform (optional)
|
| 43 |
+
run: |
|
| 44 |
+
# Deploy logic, e.g., push model to Hugging Face Spaces
|
| 45 |
+
# python deploy.py
|
.huggingface.yml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
sdk: gradio
|
| 2 |
+
app_file: app.py
|
| 3 |
+
python_version: "3.9"
|
| 4 |
+
requirements:
|
| 5 |
+
- pandas
|
| 6 |
+
- numpy
|
| 7 |
+
- scikit-learn
|
| 8 |
+
- gradio
|
Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Bước 1: Chọn image Python làm nền tảng
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Bước 2: Cài đặt các thư viện hệ thống cần thiết (nếu có)
|
| 5 |
+
# Cài đặt các thư viện như build-essential, git, và các công cụ khác nếu cần thiết cho môi trường
|
| 6 |
+
RUN apt-get update && \
|
| 7 |
+
apt-get install -y --no-install-recommends \
|
| 8 |
+
build-essential \
|
| 9 |
+
git \
|
| 10 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
+
|
| 12 |
+
# Bước 3: Tạo thư mục làm việc cho ứng dụng
|
| 13 |
+
WORKDIR /app
|
| 14 |
+
|
| 15 |
+
# Bước 4: Copy file requirements.txt vào container
|
| 16 |
+
# Đây là nơi bạn liệt kê tất cả các thư viện Python cần thiết cho dự án
|
| 17 |
+
COPY requirements.txt requirements.txt
|
| 18 |
+
|
| 19 |
+
# Bước 5: Cài đặt các thư viện Python từ requirements.txt
|
| 20 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
+
|
| 22 |
+
# Bước 6: Copy toàn bộ mã nguồn vào container
|
| 23 |
+
COPY . .
|
| 24 |
+
|
| 25 |
+
# Bước 7: Tiền xử lý dữ liệu (nếu có)
|
| 26 |
+
# Chạy một script Python để xử lý dữ liệu trước khi huấn luyện (nếu cần)
|
| 27 |
+
# Ví dụ: python src/data/preprocessing.py
|
| 28 |
+
RUN python src/data/preprocessing.py
|
| 29 |
+
|
| 30 |
+
# Bước 8: Huấn luyện mô hình
|
| 31 |
+
# Chạy một script Python để huấn luyện mô hình
|
| 32 |
+
# Ví dụ: python src/models/train.py
|
| 33 |
+
RUN python src/models/train.py
|
| 34 |
+
|
| 35 |
+
# Bước 9: Expose cổng cho ứng dụng web (nếu sử dụng Gradio, Flask hoặc FastAPI)
|
| 36 |
+
EXPOSE 7860
|
| 37 |
+
|
| 38 |
+
# Bước 10: Chạy ứng dụng khi container bắt đầu
|
| 39 |
+
# Ví dụ: Nếu sử dụng Gradio cho giao diện người dùng
|
| 40 |
+
CMD ["python", "app.py"]
|
README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Project MLops
|
| 3 |
+
emoji: 🐠
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: pink
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
sdk_version: 1.41.1
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
short_description: MLops
|
| 11 |
+
---
|
app.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Application entry point
|
| 2 |
+
if __name__ == "__main__":
|
| 3 |
+
print("Hello, Hugging Face Spaces!")
|
requirements.txt
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers
|
| 2 |
+
torch
|
| 3 |
+
scikit-learn
|
| 4 |
+
pandas
|
| 5 |
+
numpy
|
| 6 |
+
flask
|
| 7 |
+
gradio
|
| 8 |
+
pytest
|
| 9 |
+
huggingface_hub
|
scripts/deploy_model.sh
ADDED
|
File without changes
|
scripts/run_training.sh
ADDED
|
File without changes
|
scripts/update_data.sh
ADDED
|
File without changes
|