VivDubs commited on
Commit
9eb5faa
Β·
1 Parent(s): a62b668

refactor: move backend files into backend/ directory

Browse files

- src/, api.py, main.py, requirements.txt, Dockerfile, .env.example, configs/ -> backend/
- Dockerfile COPY paths updated for repo-root build context (HF Spaces compatible)
- render.yaml dockerfilePath updated to ./backend/Dockerfile
- README.md dockerfile_path updated for HF Spaces
- config.py project_root supports EUMORA_ROOT env var override for local dev

README.md CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
1
  # EUMORA - Emotion-Aware Music Recommendation System
2
 
3
  **Advanced lyrical emotion analysis with custom-trained transformer models and real-time visualization.**
 
1
+ ---
2
+ title: EUMORA API
3
+ emoji: 🎡
4
+ colorFrom: purple
5
+ colorTo: blue
6
+ sdk: docker
7
+ app_port: 8000
8
+ dockerfile_path: backend/Dockerfile
9
+ pinned: false
10
+ ---
11
+
12
  # EUMORA - Emotion-Aware Music Recommendation System
13
 
14
  **Advanced lyrical emotion analysis with custom-trained transformer models and real-time visualization.**
.env.example β†’ backend/.env.example RENAMED
File without changes
Dockerfile β†’ backend/Dockerfile RENAMED
@@ -11,16 +11,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
11
  # ---- deps ----
12
  FROM base AS deps
13
 
14
- COPY requirements.txt .
15
  RUN pip install --no-cache-dir --upgrade pip \
16
  && pip install --no-cache-dir -r requirements.txt
17
 
18
  # ---- app ----
19
  FROM deps AS app
20
 
21
- # Copy source (model files are excluded via .dockerignore)
22
- COPY src/ ./src/
23
- COPY api.py .
24
 
25
  # HuggingFace cache lives in a writable dir
26
  ENV HF_HOME=/app/.cache/huggingface
 
11
  # ---- deps ----
12
  FROM base AS deps
13
 
14
+ COPY backend/requirements.txt .
15
  RUN pip install --no-cache-dir --upgrade pip \
16
  && pip install --no-cache-dir -r requirements.txt
17
 
18
  # ---- app ----
19
  FROM deps AS app
20
 
21
+ # Copy source β€” paths relative to repo root (HF Spaces build context)
22
+ COPY backend/src/ ./src/
23
+ COPY backend/api.py .
24
 
25
  # HuggingFace cache lives in a writable dir
26
  ENV HF_HOME=/app/.cache/huggingface
api.py β†’ backend/api.py RENAMED
File without changes
{configs β†’ backend/configs}/.gitkeep RENAMED
File without changes
main.py β†’ backend/main.py RENAMED
File without changes
requirements.txt β†’ backend/requirements.txt RENAMED
File without changes
{src β†’ backend/src}/__init__.py RENAMED
File without changes
{src β†’ backend/src}/config.py RENAMED
@@ -1,5 +1,6 @@
1
  """Configuration settings for EUMORA lyrical analysis."""
2
 
 
3
  from dataclasses import dataclass, field
4
  from pathlib import Path
5
  from typing import Dict, List, Optional
@@ -10,7 +11,12 @@ class Config:
10
  """Training and model configuration."""
11
 
12
  # Paths
13
- project_root: Path = field(default_factory=lambda: Path(__file__).parent.parent)
 
 
 
 
 
14
 
15
  @property
16
  def data_dir(self) -> Path:
 
1
  """Configuration settings for EUMORA lyrical analysis."""
2
 
3
+ import os
4
  from dataclasses import dataclass, field
5
  from pathlib import Path
6
  from typing import Dict, List, Optional
 
11
  """Training and model configuration."""
12
 
13
  # Paths
14
+ # EUMORA_ROOT can be set to the repo root when running from outside backend/
15
+ project_root: Path = field(
16
+ default_factory=lambda: Path(
17
+ os.environ.get("EUMORA_ROOT", str(Path(__file__).parent.parent))
18
+ )
19
+ )
20
 
21
  @property
22
  def data_dir(self) -> Path:
{src β†’ backend/src}/dataset.py RENAMED
File without changes
{src β†’ backend/src}/model.py RENAMED
File without changes
{src β†’ backend/src}/predict.py RENAMED
File without changes
{src β†’ backend/src}/spotify.py RENAMED
File without changes
{src β†’ backend/src}/train.py RENAMED
File without changes
{src β†’ backend/src}/visualize.py RENAMED
File without changes
render.yaml CHANGED
@@ -2,7 +2,7 @@ services:
2
  - type: web
3
  name: eumora-api
4
  runtime: docker
5
- dockerfilePath: ./Dockerfile
6
  plan: standard # 4 GB RAM β€” required for DeBERTa inference
7
  numInstances: 1
8
  healthCheckPath: /health
 
2
  - type: web
3
  name: eumora-api
4
  runtime: docker
5
+ dockerfilePath: ./backend/Dockerfile
6
  plan: standard # 4 GB RAM β€” required for DeBERTa inference
7
  numInstances: 1
8
  healthCheckPath: /health