Spaces:
Running
Running
Commit
Β·
0caca00
1
Parent(s):
321ea93
Refactor application structure: update model import paths from 'app.model' to 'app.modelz' across multiple files for consistency, and introduce new database models in 'app.modelz.database' to enhance organization and clarity in the codebase.
Browse files- Dockerfile +1 -1
- alembic/env.py +1 -1
- app/api/audiobook_routes.py +1 -1
- app/api/routes.py +1 -1
- app/api/streaming.py +1 -1
- app/db.py +1 -1
- app/generator.py +1 -1
- app/main.py +1 -1
- app/{model β modelz}/__init__.py +1 -1
- app/{model β modelz}/database.py +0 -0
- app/voice_cloning.py +1 -1
- app/voice_enhancement.py +1 -1
- app/voice_memory.py +1 -1
- scripts/migrate.py +7 -7
Dockerfile
CHANGED
@@ -34,7 +34,7 @@ COPY . .
|
|
34 |
# Debug: Show destination directory structure
|
35 |
RUN echo "Contents of /app:" && ls -la /app && \
|
36 |
echo "\nContents of /app/app:" && ls -la /app/app && \
|
37 |
-
echo "\nContents of /app/app/
|
38 |
|
39 |
# Set up permissions
|
40 |
RUN chmod +x /app/scripts/run.sh && \
|
|
|
34 |
# Debug: Show destination directory structure
|
35 |
RUN echo "Contents of /app:" && ls -la /app && \
|
36 |
echo "\nContents of /app/app:" && ls -la /app/app && \
|
37 |
+
echo "\nContents of /app/app/modelz:" && ls -la app/app/modelz
|
38 |
|
39 |
# Set up permissions
|
40 |
RUN chmod +x /app/scripts/run.sh && \
|
alembic/env.py
CHANGED
@@ -5,7 +5,7 @@ from sqlalchemy import pool
|
|
5 |
|
6 |
from alembic import context
|
7 |
|
8 |
-
from app.
|
9 |
from app.config import get_settings
|
10 |
|
11 |
# this is the Alembic Config object, which provides
|
|
|
5 |
|
6 |
from alembic import context
|
7 |
|
8 |
+
from app.modelz.database import Base
|
9 |
from app.config import get_settings
|
10 |
|
11 |
# this is the Alembic Config object, which provides
|
app/api/audiobook_routes.py
CHANGED
@@ -11,7 +11,7 @@ from typing import Optional, List
|
|
11 |
from fastapi import APIRouter, Request, HTTPException, BackgroundTasks, UploadFile, File, Form, Depends
|
12 |
from fastapi.responses import FileResponse, JSONResponse
|
13 |
from sqlalchemy.orm import Session
|
14 |
-
from app.
|
15 |
from app.services.storage import storage
|
16 |
from app.db import get_db
|
17 |
import torchaudio
|
|
|
11 |
from fastapi import APIRouter, Request, HTTPException, BackgroundTasks, UploadFile, File, Form, Depends
|
12 |
from fastapi.responses import FileResponse, JSONResponse
|
13 |
from sqlalchemy.orm import Session
|
14 |
+
from app.modelz.database import Audiobook, AudiobookStatus, AudiobookChunk, TextChunk
|
15 |
from app.services.storage import storage
|
16 |
from app.db import get_db
|
17 |
import torchaudio
|
app/api/routes.py
CHANGED
@@ -16,7 +16,7 @@ import numpy as np
|
|
16 |
from fastapi import APIRouter, Request, HTTPException, BackgroundTasks, Body, Response, Query
|
17 |
from fastapi.responses import StreamingResponse
|
18 |
from app.api.schemas import SpeechRequest, ResponseFormat, Voice
|
19 |
-
from app.
|
20 |
from app.api.streaming import AudioChunker
|
21 |
from app.prompt_engineering import split_into_segments
|
22 |
|
|
|
16 |
from fastapi import APIRouter, Request, HTTPException, BackgroundTasks, Body, Response, Query
|
17 |
from fastapi.responses import StreamingResponse
|
18 |
from app.api.schemas import SpeechRequest, ResponseFormat, Voice
|
19 |
+
from app.modelz import Segment
|
20 |
from app.api.streaming import AudioChunker
|
21 |
from app.prompt_engineering import split_into_segments
|
22 |
|
app/api/streaming.py
CHANGED
@@ -10,7 +10,7 @@ from fastapi import APIRouter, Request, HTTPException
|
|
10 |
from fastapi.responses import StreamingResponse
|
11 |
from app.api.schemas import SpeechRequest, ResponseFormat
|
12 |
from app.prompt_engineering import split_into_segments
|
13 |
-
from app.
|
14 |
|
15 |
logger = logging.getLogger(__name__)
|
16 |
router = APIRouter()
|
|
|
10 |
from fastapi.responses import StreamingResponse
|
11 |
from app.api.schemas import SpeechRequest, ResponseFormat
|
12 |
from app.prompt_engineering import split_into_segments
|
13 |
+
from app.modelz import Segment
|
14 |
|
15 |
logger = logging.getLogger(__name__)
|
16 |
router = APIRouter()
|
app/db.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
import os
|
3 |
from sqlalchemy import create_engine
|
4 |
from sqlalchemy.orm import sessionmaker
|
5 |
-
from app.
|
6 |
|
7 |
# Get database URL from environment or use SQLite as default
|
8 |
DATABASE_URL = os.getenv(
|
|
|
2 |
import os
|
3 |
from sqlalchemy import create_engine
|
4 |
from sqlalchemy.orm import sessionmaker
|
5 |
+
from app.modelz.database import Base
|
6 |
|
7 |
# Get database URL from environment or use SQLite as default
|
8 |
DATABASE_URL = os.getenv(
|
app/generator.py
CHANGED
@@ -8,7 +8,7 @@ import os
|
|
8 |
from huggingface_hub import hf_hub_download
|
9 |
from transformers import AutoTokenizer
|
10 |
from tokenizers.processors import TemplateProcessing
|
11 |
-
from app.
|
12 |
from app.text_normalizer import clean_text_for_tts
|
13 |
from app.text_normalizer import TextNormalizer
|
14 |
|
|
|
8 |
from huggingface_hub import hf_hub_download
|
9 |
from transformers import AutoTokenizer
|
10 |
from tokenizers.processors import TemplateProcessing
|
11 |
+
from app.modelz import Segment
|
12 |
from app.text_normalizer import clean_text_for_tts
|
13 |
from app.text_normalizer import TextNormalizer
|
14 |
|
app/main.py
CHANGED
@@ -18,7 +18,7 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
18 |
from fastapi.responses import RedirectResponse, FileResponse
|
19 |
from fastapi.staticfiles import StaticFiles
|
20 |
from app.api.routes import router as api_router
|
21 |
-
from app.
|
22 |
|
23 |
# Setup logging
|
24 |
os.makedirs("logs", exist_ok=True)
|
|
|
18 |
from fastapi.responses import RedirectResponse, FileResponse
|
19 |
from fastapi.staticfiles import StaticFiles
|
20 |
from app.api.routes import router as api_router
|
21 |
+
from app.modelz.database import Base, get_db
|
22 |
|
23 |
# Setup logging
|
24 |
os.makedirs("logs", exist_ok=True)
|
app/{model β modelz}/__init__.py
RENAMED
@@ -1,5 +1,5 @@
|
|
1 |
"""Models package initialization."""
|
2 |
-
from app.
|
3 |
|
4 |
__all__ = [
|
5 |
'Base',
|
|
|
1 |
"""Models package initialization."""
|
2 |
+
from app.modelz.database import Base, Audiobook, AudiobookChunk, TextChunk, AudiobookStatus
|
3 |
|
4 |
__all__ = [
|
5 |
'Base',
|
app/{model β modelz}/database.py
RENAMED
File without changes
|
app/voice_cloning.py
CHANGED
@@ -21,7 +21,7 @@ import torchaudio
|
|
21 |
from pydantic import BaseModel
|
22 |
from fastapi import UploadFile
|
23 |
|
24 |
-
from app.
|
25 |
|
26 |
# Set up logging
|
27 |
logger = logging.getLogger(__name__)
|
|
|
21 |
from pydantic import BaseModel
|
22 |
from fastapi import UploadFile
|
23 |
|
24 |
+
from app.modelz import Segment
|
25 |
|
26 |
# Set up logging
|
27 |
logger = logging.getLogger(__name__)
|
app/voice_enhancement.py
CHANGED
@@ -476,7 +476,7 @@ def get_voice_segments(voice_name: str, device: torch.device) -> List:
|
|
476 |
Returns:
|
477 |
List of context segments
|
478 |
"""
|
479 |
-
from app.
|
480 |
|
481 |
if voice_name not in VOICE_PROFILES:
|
482 |
logger.warning(f"Voice {voice_name} not found, defaulting to alloy")
|
|
|
476 |
Returns:
|
477 |
List of context segments
|
478 |
"""
|
479 |
+
from app.modelz import Segment
|
480 |
|
481 |
if voice_name not in VOICE_PROFILES:
|
482 |
logger.warning(f"Voice {voice_name} not found, defaulting to alloy")
|
app/voice_memory.py
CHANGED
@@ -7,7 +7,7 @@ import random
|
|
7 |
import logging
|
8 |
from typing import Dict, List, Optional
|
9 |
from dataclasses import dataclass
|
10 |
-
from app.
|
11 |
|
12 |
# Setup logging
|
13 |
logger = logging.getLogger(__name__)
|
|
|
7 |
import logging
|
8 |
from typing import Dict, List, Optional
|
9 |
from dataclasses import dataclass
|
10 |
+
from app.modelz import Segment
|
11 |
|
12 |
# Setup logging
|
13 |
logger = logging.getLogger(__name__)
|
scripts/migrate.py
CHANGED
@@ -21,13 +21,13 @@ logger = logging.getLogger(__name__)
|
|
21 |
logger.info(f"Current directory: {os.getcwd()}")
|
22 |
logger.info(f"Python Path (sys.path): {sys.path}")
|
23 |
|
24 |
-
models_db_path = "/app/app/
|
25 |
logger.info(f"Checking existence of {models_db_path}: {os.path.exists(models_db_path)}")
|
26 |
|
27 |
try:
|
28 |
# Direct import, assuming PYTHONPATH is correct
|
29 |
-
from app.
|
30 |
-
logger.info("Successfully imported Base from app.
|
31 |
except ImportError as e:
|
32 |
logger.error(f"Error importing Base: {e}")
|
33 |
# Log directory contents for deeper debugging
|
@@ -43,12 +43,12 @@ except ImportError as e:
|
|
43 |
logger.info(os.listdir("/app/app"))
|
44 |
except Exception as list_err:
|
45 |
logger.error(f"Could not list /app/app: {list_err}")
|
46 |
-
logger.info("Contents of /app/app/
|
47 |
-
if os.path.exists("/app/app/
|
48 |
try:
|
49 |
-
logger.info(os.listdir("/app/app/
|
50 |
except Exception as list_err:
|
51 |
-
logger.error(f"Could not list /app/app/
|
52 |
raise
|
53 |
|
54 |
def run_migrations():
|
|
|
21 |
logger.info(f"Current directory: {os.getcwd()}")
|
22 |
logger.info(f"Python Path (sys.path): {sys.path}")
|
23 |
|
24 |
+
models_db_path = "/app/app/modelz/database.py"
|
25 |
logger.info(f"Checking existence of {models_db_path}: {os.path.exists(models_db_path)}")
|
26 |
|
27 |
try:
|
28 |
# Direct import, assuming PYTHONPATH is correct
|
29 |
+
from app.modelz.database import Base
|
30 |
+
logger.info("Successfully imported Base from app.modelz.database")
|
31 |
except ImportError as e:
|
32 |
logger.error(f"Error importing Base: {e}")
|
33 |
# Log directory contents for deeper debugging
|
|
|
43 |
logger.info(os.listdir("/app/app"))
|
44 |
except Exception as list_err:
|
45 |
logger.error(f"Could not list /app/app: {list_err}")
|
46 |
+
logger.info("Contents of /app/app/modelz:")
|
47 |
+
if os.path.exists("/app/app/modelz"):
|
48 |
try:
|
49 |
+
logger.info(os.listdir("/app/app/modelz"))
|
50 |
except Exception as list_err:
|
51 |
+
logger.error(f"Could not list /app/app/modelz: {list_err}")
|
52 |
raise
|
53 |
|
54 |
def run_migrations():
|