Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a0ae552
[FEAT] 크롤링 데이터 받아오기
et007693 Jul 12, 2025
e046319
Merge pull request #6 from AutoeverInsideMovie/feat/#5
et007693 Jul 12, 2025
ce59b88
initial commit
Gumraze-git Jul 10, 2025
bce49f9
[FEAT] 감정 분석 데이터 세트 추가
Gumraze-git Jul 11, 2025
bf616ba
[REFAC] 불필요한 주석 제거
Gumraze-git Jul 11, 2025
f89a425
[FEAT] 감정 상태 상수 추가
Gumraze-git Jul 11, 2025
18f7b42
[FEAT] 설정 파일 수정 및 모델 경로 환경변수 추가
Gumraze-git Jul 11, 2025
2968fe4
[FEAT] 감정 예측 라우터 추가
Gumraze-git Jul 11, 2025
742123c
[FEAT] 감정 예측 함수 추가
Gumraze-git Jul 11, 2025
5d9f73c
[FEAT] Pydantic 데이터 스키마 추가
Gumraze-git Jul 11, 2025
551f476
[FEAT] 감정 예측 라우터 등록
Gumraze-git Jul 11, 2025
7087eb0
[FEAT] KoBERT 감정 분석 모델 파일 추가
Gumraze-git Jul 11, 2025
809b493
[FEAT] 감정 분석 데이터 세트 증강 데이터 추가
Gumraze-git Jul 12, 2025
be40c9e
[FEAT] KoBERT 5 및 6 감정 분석 모델 파일 추가
Gumraze-git Jul 12, 2025
a6f36c1
[FEAT] 감정 상태 상수 업데이트
Gumraze-git Jul 12, 2025
c6565ac
[REFAC] KoBERT 7가지 감정 분석 모델 파일 이름 수정
Gumraze-git Jul 12, 2025
23e0199
[FEAT] KoBERT 5가지 감정 분석 모델을 사용하도록 수정
Gumraze-git Jul 12, 2025
b441d67
[FIX] 모델 디렉터리 경로 수정
Gumraze-git Jul 12, 2025
1f770d0
[FIX] LABELS_6 및 LABELS_5 상수 수정
Gumraze-git Jul 12, 2025
fedcba3
[FEAT] KoBERT 5가지 감정 분석 결과 반환 로직 수정
Gumraze-git Jul 12, 2025
1fd1d2c
[CHORE] LABELS_7 라벨 순서 확인 및 수정 필요
Gumraze-git Jul 12, 2025
ac2ed83
[CHORE] 모델 가중치 파일 Git LFS로 처리하도록 이동
Gumraze-git Jul 12, 2025
5bc9a81
Merge pull request #7 from AutoeverInsideMovie/feat/#4
Gumraze-git Jul 12, 2025
e8529ab
[CHORE] 사용하지 않는 데이터 파일 정리
Gumraze-git Jul 13, 2025
eaa3c28
[CHORE] 불필요한 KoBERT 모델 파일 정리
Gumraze-git Jul 13, 2025
64f47d8
[CHORE] 사용하지 않는 상수 제거
Gumraze-git Jul 13, 2025
c393439
Merge pull request #9 from AutoeverInsideMovie/feat/#8
Sangyoon98 Jul 13, 2025
cdac87c
[FEAT] 감정 예측 로직 확장 및 평균 계산 함수 추가
Gumraze-git Jul 13, 2025
d69aa9a
[FEAT] 감정 예측 엔드포인트 확장 및 세 가지 새로운 예측 로직 추가
Gumraze-git Jul 13, 2025
a36001c
[FEAT] 감정 예측 확률을 백분율 형식으로 변환하는 로직 추가
Gumraze-git Jul 13, 2025
eb4c53f
[CHORE] 예측 기록 조회 엔드포인트 제거 및 코드 정리
Gumraze-git Jul 13, 2025
3ce1877
Merge pull request #11 from AutoeverInsideMovie/feat/#10
Sangyoon98 Jul 13, 2025
fbb6934
[CHORE] 프로젝트 종속성 정의를 위한 environment.yml 추가
Gumraze-git Jul 14, 2025
fd2fbc9
[DOCS] README 설치 가이드 추가
Gumraze-git Jul 14, 2025
6ecf796
Merge pull request #13 from AutoeverInsideMovie/refac/#12
Sangyoon98 Jul 14, 2025
427aa13
[CHORE] .gitignore 파일 추가
Gumraze-git Jul 14, 2025
3346b17
[DOCS] README 설치 가이드 수정 및 venv 설치 방법 추가
Gumraze-git Jul 14, 2025
464376b
[CHORE] 프로젝트 종속성 정의를 위한 requirements.txt 추가
Gumraze-git Jul 14, 2025
d5d6c5e
[CHORE] LABELS 상수 라벨링 순서 수정
Gumraze-git Jul 14, 2025
4d6513f
Merge pull request #15 from AutoeverInsideMovie/refac/#14
Sangyoon98 Jul 14, 2025
d544a78
Merge pull request #17 from AutoeverInsideMovie/refac/#16
Sangyoon98 Jul 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
models/**/*.safetensors filter=lfs diff=lfs merge=lfs -text
models/**/*.spiece.model filter=lfs diff=lfs merge=lfs -text
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# 가상환경
.venv/
venv/
env/
ENV/

# 로그 파일
*.log

# macOS 메타데이터
.DS_Store

# IDE 설정 파일
.vscode/
.idea/
62 changes: 61 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,61 @@
# Inside movie AI
# Inside movie AI

## 1. 가상 환경 및 패키지 간단 설치 방법
```bash
# 프로젝트 루트에 environment.yml이 있어야 합니다.
conda env create -n Insidemovie-AI -f environment.yml
```

**환경 활성화**
```bash
conda activate Insidemovie-AI
```

- - -
## 2. Conda 환경 설치 방법
### Conda 가상 환경 생성
```bash
conda create -n Insidemovie-AI python=3.12.11
```

### 생성한 가상 환경 실행
```bash
conda activate Insidemovie-AI
```
## 3. venv 환경에서 설치 방법
- `Insidemovie-AI` 이름으로 가상환경 생성
```bash
python3 -m venv --prompt Insidemovie-AI .venv
```

- 환경 활성화
```bash
source .venv/bin/activate
```


## 4. 패키지 요구사항
- uvicorn == 0.35.0
- fastapi == 0.116.1
- pytorch == 2.7.1
- transformers == 4.53.2
- pydantic-settings
- sentencepiece == 0.2.0
- motor

#### 패키지 설치 코드
```bash
pip install \
uvicorn==0.35.0 \
fastapi==0.116.1 \
torch==2.7.1 \
transformers==4.53.2 \
pydantic-settings \
sentencepiece==0.2.0 \
motor
```

#### KoBERT 설치
```bash
pip install 'git+https://github.com/SKTBrain/KoBERT.git#egg=kobert_tokenizer&subdirectory=kobert_hf'
```
8 changes: 4 additions & 4 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# config.py
import os
from pydantic_settings import BaseSettings, SettingsConfigDict

class Settings(BaseSettings):
db_name: str = "emotion_db"
mongodb_uri: str = "mongodb://localhost:27017"
db_name: str = "emotion_db"
collection_name: str = "predictions"
title: str = "Inside Movie AI"
model_dir: str = os.getenv("MODEL_DIR", "models/0712_kobert_5_emotion_model")
title: str = "MovieMood - KoBERT Emotion API"

# .env 파일 자동 로딩 설정
model_config = SettingsConfigDict(env_file=".env")

settings = Settings()
8 changes: 8 additions & 0 deletions const.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 7 가지 감정 상태
# 기쁨, 슬픔, 분노, 놀람, 혐오, 공포, 중립
LABELS_6 = [
"anger", "fear", "joy", "neutral", "sadness", "surprise"
]
LABELS_5 = [
"anger", "fear", "joy", "neutral", "sadness"
]
1 change: 0 additions & 1 deletion db.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# app/db.py
from motor.motor_asyncio import AsyncIOMotorClient
from config import settings

Expand Down
64 changes: 64 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Insidemovie-AI
channels:
- defaults
dependencies:
- bzip2=1.0.8=h80987f9_6
- ca-certificates=2025.2.25=hca03da5_0
- expat=2.7.1=h313beb8_0
- libcxx=17.0.6=he5c5206_4
- libffi=3.4.4=hca03da5_1
- ncurses=6.4=h313beb8_0
- openssl=3.0.16=h02f6b3c_0
- pip=25.1=pyhc872135_2
- python=3.12.11=h421de30_0
- readline=8.2=h1a28f6b_0
- setuptools=78.1.1=py312hca03da5_0
- sqlite=3.45.3=h80987f9_0
- tk=8.6.14=h6ba3021_1
- tzdata=2025b=h04d1e81_0
- wheel=0.45.1=py312hca03da5_0
- xz=5.6.4=h80987f9_1
- zlib=1.2.13=h18a0788_1
- pip:
- annotated-types==0.7.0
- anyio==4.9.0
- certifi==2025.7.9
- charset-normalizer==3.4.2
- click==8.2.1
- dnspython==2.7.0
- fastapi==0.116.1
- filelock==3.18.0
- fsspec==2025.5.1
- h11==0.16.0
- hf-xet==1.1.5
- huggingface-hub==0.33.4
- idna==3.10
- jinja2==3.1.6
- kobert-tokenizer==0.1
- markupsafe==3.0.2
- motor==3.7.1
- mpmath==1.3.0
- networkx==3.5
- numpy==2.3.1
- packaging==25.0
- pydantic==2.11.7
- pydantic-core==2.33.2
- pydantic-settings==2.10.1
- pymongo==4.13.2
- python-dotenv==1.1.1
- pyyaml==6.0.2
- regex==2024.11.6
- requests==2.32.4
- safetensors==0.5.3
- sentencepiece==0.2.0
- sniffio==1.3.1
- starlette==0.47.1
- sympy==1.14.0
- tokenizers==0.21.2
- torch==2.7.1
- tqdm==4.67.1
- transformers==4.53.2
- typing-extensions==4.14.1
- typing-inspection==0.4.1
- urllib3==2.5.0
- uvicorn==0.35.0
8 changes: 5 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# main.py
import uvicorn
from fastapi import FastAPI
from config import settings
from db import collection
from routers.home import router as home_router
from routers.predict import router as predict_router

app = FastAPI(title=settings.title)

# 라우터 등록
app.include_router(home_router)
app.include_router(predict_router)

if __name__ == "__main__":
import uvicorn
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
42 changes: 42 additions & 0 deletions models/0712_kobert_5_emotion_model/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"architectures": [
"BertForSequenceClassification"
],
"attention_probs_dropout_prob": 0.1,
"author": "Heewon Jeon(madjakarta@gmail.com)",
"classifier_dropout": null,
"gradient_checkpointing": false,
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"hidden_size": 768,
"id2label": {
"0": "LABEL_0",
"1": "LABEL_1",
"2": "LABEL_2",
"3": "LABEL_3",
"4": "LABEL_4"
},
"initializer_range": 0.02,
"intermediate_size": 3072,
"kobert_version": 1.0,
"label2id": {
"LABEL_0": 0,
"LABEL_1": 1,
"LABEL_2": 2,
"LABEL_3": 3,
"LABEL_4": 4
},
"layer_norm_eps": 1e-12,
"max_position_embeddings": 512,
"model_type": "bert",
"num_attention_heads": 12,
"num_hidden_layers": 12,
"pad_token_id": 1,
"position_embedding_type": "absolute",
"problem_type": "single_label_classification",
"torch_dtype": "float32",
"transformers_version": "4.53.1",
"type_vocab_size": 2,
"use_cache": true,
"vocab_size": 8002
}
3 changes: 3 additions & 0 deletions models/0712_kobert_5_emotion_model/model.safetensors
Git LFS file not shown
15 changes: 15 additions & 0 deletions models/0712_kobert_5_emotion_model/special_tokens_map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"bos_token": "[CLS]",
"cls_token": "[CLS]",
"eos_token": "[SEP]",
"mask_token": {
"content": "[MASK]",
"lstrip": true,
"normalized": true,
"rstrip": false,
"single_word": false
},
"pad_token": "[PAD]",
"sep_token": "[SEP]",
"unk_token": "[UNK]"
}
Binary file added models/0712_kobert_5_emotion_model/spiece.model
Binary file not shown.
64 changes: 64 additions & 0 deletions models/0712_kobert_5_emotion_model/tokenizer_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"added_tokens_decoder": {
"0": {
"content": "[UNK]",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"1": {
"content": "[PAD]",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"2": {
"content": "[CLS]",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"3": {
"content": "[SEP]",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"4": {
"content": "[MASK]",
"lstrip": true,
"normalized": true,
"rstrip": false,
"single_word": false,
"special": true
}
},
"additional_special_tokens": [],
"bos_token": "[CLS]",
"clean_up_tokenization_spaces": false,
"cls_token": "[CLS]",
"do_lower_case": false,
"eos_token": "[SEP]",
"extra_special_tokens": {},
"keep_accents": false,
"mask_token": "[MASK]",
"model_max_length": 1000000000000000019884624838656,
"pad_token": "[PAD]",
"remove_space": true,
"sep_token": "[SEP]",
"sp_model_kwargs": {
"alpha": 0.6,
"enable_sampling": true,
"nbest_size": -1
},
"tokenizer_class": "KoBERTTokenizer",
"unk_token": "[UNK]"
}
42 changes: 42 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
annotated-types==0.7.0
anyio==4.9.0
certifi==2025.7.14
charset-normalizer==3.4.2
click==8.2.1
dnspython==2.7.0
fastapi==0.116.1
filelock==3.18.0
fsspec==2025.5.1
h11==0.16.0
hf-xet==1.1.5
huggingface-hub==0.33.4
idna==3.10
Jinja2==3.1.6
kobert-tokenizer @ git+https://github.com/SKTBrain/KoBERT.git@fcd729f2f4b37858f333597c0782388ada51eb5f#subdirectory=kobert_hf
MarkupSafe==3.0.2
motor==3.7.1
mpmath==1.3.0
networkx==3.5
numpy==2.3.1
packaging==25.0
pydantic==2.11.7
pydantic-settings==2.10.1
pydantic_core==2.33.2
pymongo==4.13.2
python-dotenv==1.1.1
PyYAML==6.0.2
regex==2024.11.6
requests==2.32.4
safetensors==0.5.3
sentencepiece==0.2.0
sniffio==1.3.1
starlette==0.47.1
sympy==1.14.0
tokenizers==0.21.2
torch==2.7.1
tqdm==4.67.1
transformers==4.53.2
typing-inspection==0.4.1
typing_extensions==4.14.1
urllib3==2.5.0
uvicorn==0.35.0
1 change: 0 additions & 1 deletion routers/home.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# routers/home.py
from fastapi import APIRouter
from config import settings

Expand Down
Loading