κ°•λ―Όκ·  commited on
Commit
9f03b39
Β·
1 Parent(s): aa1a383

Refactor: Combine Backend and Frontend into Monorepo structure

Browse files
Dockerfile CHANGED
@@ -1,22 +1,15 @@
1
  FROM python:3.9-slim
2
 
3
- # λ³΄μ•ˆ 및 κΆŒν•œ 섀정을 μœ„ν•œ μœ μ € 생성 (Hugging Face ꢌμž₯ 사항)
4
- RUN useradd -m -u 1000 user
5
- USER user
6
- ENV PATH="/home/user/.local/bin:$PATH"
7
 
8
- WORKDIR /app
 
9
 
10
- # μ˜μ‘΄μ„± μ„€μΉ˜
11
- COPY --chown=user requirements.txt requirements.txt
12
- RUN pip install --no-cache-dir --upgrade pip && \
13
- pip install --no-cache-dir -r requirements.txt
14
 
15
- # μ½”λ“œ 볡사 (λͺ¨λΈ 파일 포함)
16
- COPY --chown=user . .
17
 
18
- # 포트 μ„€μ • (Hugging FaceλŠ” 7860 포트λ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€)
19
- EXPOSE 7860
20
-
21
- # μ‹€ν–‰ λͺ…λ Ήμ–΄
22
  CMD ["uvicorn", "src.api:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.9-slim
2
 
3
+ WORKDIR /code
 
 
 
4
 
5
+ # Copy backend files
6
+ COPY ./backend /code/backend
7
 
8
+ # Change working directory to backend
9
+ WORKDIR /code/backend
 
 
10
 
11
+ # Install dependencies
12
+ RUN pip install --no-cache-dir -r requirements.txt
13
 
14
+ # Run the application
 
 
 
15
  CMD ["uvicorn", "src.api:app", "--host", "0.0.0.0", "--port", "7860"]
README.md CHANGED
@@ -5,92 +5,35 @@ colorFrom: yellow
5
  colorTo: red
6
  sdk: docker
7
  pinned: false
 
8
  ---
9
 
10
- # 🍳 K-Recipe2Vec
11
 
12
- AI 기반 ν•œμ‹ μ‹μž¬λ£Œ λŒ€μ²΄ μΆ”μ²œ μ„œλΉ„μŠ€
13
 
14
- ## πŸ“– Overview
 
15
 
16
- ν•œκ΅­ μš”λ¦¬μ—μ„œ μ‹μž¬λ£Œλ₯Ό λŒ€μ²΄ν•  수 μžˆλŠ” 재료λ₯Ό AIκ°€ μΆ”μ²œν•΄μ£ΌλŠ” μ›Ή μ„œλΉ„μŠ€μž…λ‹ˆλ‹€.
17
- Doc2Vecκ³Ό Word2Vec λͺ¨λΈμ„ ν™œμš©ν•˜μ—¬ μ‹μž¬λ£Œ κ°„μ˜ 의미적 μœ μ‚¬λ„λ₯Ό λΆ„μ„ν•©λ‹ˆλ‹€.
18
 
19
- ## πŸ”— Demo
20
-
21
- πŸš€ **[Live Demo](https://korea-recipe-ai.streamlit.app/)** - Streamlit Cloud 배포
22
-
23
- ## ✨ Features
24
-
25
- - **πŸ₯¬ μ‹μž¬λ£Œ λŒ€μ²΄ μΆ”μ²œ**: μ—†λŠ” μž¬λ£Œμ— λŒ€ν•œ μœ μ‚¬ 재료 μΆ”μ²œ
26
- - **πŸ“Š 3D μ‹œκ°ν™”**: PCA 기반 재료 벑터 곡간 μ‹œκ°ν™”
27
- - **πŸ’° 가격 정보**: μž¬λ£Œλ³„ 가격 정보 제곡
28
- - **☁️ μ›Œλ“œν΄λΌμš°λ“œ**: μΆ”μ²œ 재료 μ‹œκ°ν™”
29
-
30
- ## πŸ› οΈ Tech Stack
31
-
32
- | Category | Technologies |
33
- |----------|-------------|
34
- | **Frontend** | Streamlit |
35
- | **ML Models** | Gensim (Doc2Vec, Word2Vec) |
36
- | **Data Processing** | Pandas, NumPy |
37
- | **Visualization** | Plotly, Matplotlib, WordCloud |
38
- | **Database** | Supabase |
39
- | **Deployment** | Streamlit Cloud |
40
-
41
- ## πŸ“ Project Structure
42
-
43
- ```
44
- k-recipe2vec/
45
- β”œβ”€β”€ app.py # Main Streamlit application
46
- β”œβ”€β”€ logic.py # Core recommendation logic (if exists)
47
- β”œβ”€β”€ requirements.txt # Python dependencies
48
- β”œβ”€β”€ d2v.model # Doc2Vec trained model
49
- β”œβ”€β”€ w2v.model # Word2Vec trained model
50
- β”œβ”€β”€ price_rank.csv # Price data
51
- └── stats.pkl # Preprocessed statistics
52
- ```
53
 
54
  ## πŸš€ Getting Started
55
 
56
- ### Prerequisites
57
-
58
- - Python 3.8+
59
- - pip
60
-
61
- ### Installation
62
 
63
  ```bash
64
- # Clone the repository
65
- git clone https://github.com/nneans/k-recipe2vec.git
66
- cd k-recipe2vec
67
-
68
- # Install dependencies
69
  pip install -r requirements.txt
70
-
71
- # Run the app
72
- streamlit run src/app.py
73
  ```
74
 
75
- ## πŸ“Š Model Information
76
-
77
- ### Doc2Vec Model
78
- - ν•œκ΅­ λ ˆμ‹œν”Ό 데이터 기반 ν•™μŠ΅
79
- - λ ˆμ‹œν”Ό λ‹¨μœ„ λ¬Έμ„œ μž„λ² λ”©
80
-
81
- ### Word2Vec Model
82
- - μ‹μž¬λ£Œ κ°„ 의미적 μœ μ‚¬λ„ ν•™μŠ΅
83
- - λŒ€μ²΄ κ°€λŠ₯ν•œ 재료 μΆ”μ²œμ— ν™œμš©
84
-
85
- ## 🀝 Contributing
86
-
87
- 버그 리포트, κΈ°λŠ₯ μ œμ•ˆ, PR ν™˜μ˜ν•©λ‹ˆλ‹€!
88
 
89
- ## πŸ“ License
90
-
91
- MIT License
92
-
93
- ## πŸ‘€ Author
94
-
95
- **Mingyun Kang**
96
- - GitHub: [@nneans](https://github.com/nneans)
 
5
  colorTo: red
6
  sdk: docker
7
  pinned: false
8
+ app_port: 7860
9
  ---
10
 
11
+ # 🍳 K-Recipe2Vec (Monorepo)
12
 
13
+ 이 λ¦¬ν¬μ§€ν† λ¦¬λŠ” λ°±μ—”λ“œ API와 ν”„λ‘ νŠΈμ—”λ“œ μ›Ήμ‚¬μ΄νŠΈλ₯Ό ν¬ν•¨ν•˜λŠ” λͺ¨λ…Έλ ˆν¬μž…λ‹ˆλ‹€.
14
 
15
+ - **Frontend**: [Github Pages](https://nneans.github.io/k-recipe2vec/)
16
+ - **Backend API**: [Hugging Face Space](https://huggingface.co/spaces/nneans/k-recipe2vec)
17
 
18
+ ## πŸ“ Structure
 
19
 
20
+ - `backend/`: FastAPI 기반 AI λͺ¨λΈ API
21
+ - `web/`: React 기반 μ›Ή ν”„λ‘ νŠΈμ—”λ“œ
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  ## πŸš€ Getting Started
24
 
25
+ ### Backend
 
 
 
 
 
26
 
27
  ```bash
28
+ cd backend
 
 
 
 
29
  pip install -r requirements.txt
30
+ uvicorn src.api:app --reload
 
 
31
  ```
32
 
33
+ ### Frontend
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
+ ```bash
36
+ cd web
37
+ npm install
38
+ npm run dev
39
+ ```
 
 
 
.dockerignore β†’ backend/.dockerignore RENAMED
File without changes
.gitattributes β†’ backend/.gitattributes RENAMED
File without changes
{.github β†’ backend/.github}/workflows/fly-deploy.yml RENAMED
File without changes
.gitignore β†’ backend/.gitignore RENAMED
File without changes
backend/Dockerfile ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ # λ³΄μ•ˆ 및 κΆŒν•œ 섀정을 μœ„ν•œ μœ μ € 생성 (Hugging Face ꢌμž₯ 사항)
4
+ RUN useradd -m -u 1000 user
5
+ USER user
6
+ ENV PATH="/home/user/.local/bin:$PATH"
7
+
8
+ WORKDIR /app
9
+
10
+ # μ˜μ‘΄μ„± μ„€μΉ˜
11
+ COPY --chown=user requirements.txt requirements.txt
12
+ RUN pip install --no-cache-dir --upgrade pip && \
13
+ pip install --no-cache-dir -r requirements.txt
14
+
15
+ # μ½”λ“œ 볡사 (λͺ¨λΈ 파일 포함)
16
+ COPY --chown=user . .
17
+
18
+ # 포트 μ„€μ • (Hugging FaceλŠ” 7860 포트λ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€)
19
+ EXPOSE 7860
20
+
21
+ # μ‹€ν–‰ λͺ…λ Ήμ–΄
22
+ CMD ["uvicorn", "src.api:app", "--host", "0.0.0.0", "--port", "7860"]
backend/README.md ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: K-Recipe2Vec API
3
+ emoji: 🍳
4
+ colorFrom: yellow
5
+ colorTo: red
6
+ sdk: docker
7
+ pinned: false
8
+ ---
9
+
10
+ # 🍳 K-Recipe2Vec
11
+
12
+ AI 기반 ν•œμ‹ μ‹μž¬λ£Œ λŒ€μ²΄ μΆ”μ²œ μ„œλΉ„μŠ€
13
+
14
+ ## πŸ“– Overview
15
+
16
+ ν•œκ΅­ μš”λ¦¬μ—μ„œ μ‹μž¬λ£Œλ₯Ό λŒ€μ²΄ν•  수 μžˆλŠ” 재료λ₯Ό AIκ°€ μΆ”μ²œν•΄μ£ΌλŠ” μ›Ή μ„œλΉ„μŠ€μž…λ‹ˆλ‹€.
17
+ Doc2Vecκ³Ό Word2Vec λͺ¨λΈμ„ ν™œμš©ν•˜μ—¬ μ‹μž¬λ£Œ κ°„μ˜ 의미적 μœ μ‚¬λ„λ₯Ό λΆ„μ„ν•©λ‹ˆλ‹€.
18
+
19
+ ## πŸ”— Demo
20
+
21
+ πŸš€ **[Live Demo](https://korea-recipe-ai.streamlit.app/)** - Streamlit Cloud 배포
22
+
23
+ ## ✨ Features
24
+
25
+ - **πŸ₯¬ μ‹μž¬λ£Œ λŒ€μ²΄ μΆ”μ²œ**: μ—†λŠ” μž¬λ£Œμ— λŒ€ν•œ μœ μ‚¬ 재료 μΆ”μ²œ
26
+ - **πŸ“Š 3D μ‹œκ°ν™”**: PCA 기반 재료 벑터 곡간 μ‹œκ°ν™”
27
+ - **πŸ’° 가격 정보**: μž¬λ£Œλ³„ 가격 정보 제곡
28
+ - **☁️ μ›Œλ“œν΄λΌμš°λ“œ**: μΆ”μ²œ 재료 μ‹œκ°ν™”
29
+
30
+ ## πŸ› οΈ Tech Stack
31
+
32
+ | Category | Technologies |
33
+ |----------|-------------|
34
+ | **Frontend** | Streamlit |
35
+ | **ML Models** | Gensim (Doc2Vec, Word2Vec) |
36
+ | **Data Processing** | Pandas, NumPy |
37
+ | **Visualization** | Plotly, Matplotlib, WordCloud |
38
+ | **Database** | Supabase |
39
+ | **Deployment** | Streamlit Cloud |
40
+
41
+ ## πŸ“ Project Structure
42
+
43
+ ```
44
+ k-recipe2vec/
45
+ β”œβ”€β”€ app.py # Main Streamlit application
46
+ β”œβ”€β”€ logic.py # Core recommendation logic (if exists)
47
+ β”œβ”€β”€ requirements.txt # Python dependencies
48
+ β”œβ”€β”€ d2v.model # Doc2Vec trained model
49
+ β”œβ”€β”€ w2v.model # Word2Vec trained model
50
+ β”œβ”€β”€ price_rank.csv # Price data
51
+ └── stats.pkl # Preprocessed statistics
52
+ ```
53
+
54
+ ## πŸš€ Getting Started
55
+
56
+ ### Prerequisites
57
+
58
+ - Python 3.8+
59
+ - pip
60
+
61
+ ### Installation
62
+
63
+ ```bash
64
+ # Clone the repository
65
+ git clone https://github.com/nneans/k-recipe2vec.git
66
+ cd k-recipe2vec
67
+
68
+ # Install dependencies
69
+ pip install -r requirements.txt
70
+
71
+ # Run the app
72
+ streamlit run src/app.py
73
+ ```
74
+
75
+ ## πŸ“Š Model Information
76
+
77
+ ### Doc2Vec Model
78
+ - ν•œκ΅­ λ ˆμ‹œν”Ό 데이터 기반 ν•™μŠ΅
79
+ - λ ˆμ‹œν”Ό λ‹¨μœ„ λ¬Έμ„œ μž„λ² λ”©
80
+
81
+ ### Word2Vec Model
82
+ - μ‹μž¬λ£Œ κ°„ 의미적 μœ μ‚¬λ„ ν•™μŠ΅
83
+ - λŒ€μ²΄ κ°€λŠ₯ν•œ 재료 μΆ”μ²œμ— ν™œμš©
84
+
85
+ ## 🀝 Contributing
86
+
87
+ 버그 리포트, κΈ°λŠ₯ μ œμ•ˆ, PR ν™˜μ˜ν•©λ‹ˆλ‹€!
88
+
89
+ ## πŸ“ License
90
+
91
+ MIT License
92
+
93
+ ## πŸ‘€ Author
94
+
95
+ **Mingyun Kang**
96
+ - GitHub: [@nneans](https://github.com/nneans)
{data β†’ backend/data}/final_recipe_data.csv RENAMED
File without changes
{data β†’ backend/data}/stats.pkl RENAMED
File without changes
{docs β†’ backend/docs}/logic_explanation.md RENAMED
File without changes
fly.toml β†’ backend/fly.toml RENAMED
File without changes
{models β†’ backend/models}/d2v.model RENAMED
File without changes
{models β†’ backend/models}/d2v.model.dv.vectors.npy RENAMED
File without changes
{models β†’ backend/models}/w2v.model RENAMED
File without changes
requirements.txt β†’ backend/requirements.txt RENAMED
File without changes
{src β†’ backend/src}/api.py RENAMED
File without changes
{src β†’ backend/src}/app.py RENAMED
File without changes
{src β†’ backend/src}/logic.py RENAMED
File without changes
web ADDED
@@ -0,0 +1 @@
 
 
1
+ Subproject commit a4271215feae73d4660de0c761bffa3bd3f2f20a