Spaces:
Runtime error
Runtime error
Upload 117 files
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +1 -0
- Dockerfile +58 -0
- __pycache__/preprocess.cpython-311.pyc +0 -0
- __pycache__/rose_tts_hodc.cpython-311.pyc +0 -0
- db.sqlite3 +3 -0
- docker-compose.yml +16 -0
- error.log +0 -0
- manage.py +32 -0
- models_ms/embeddings.json +8 -0
- models_ms/multispeaker.pth +3 -0
- models_ms/multispeaker_link +1 -0
- models_ms/multispeaker_speaker_embeddings.pt +3 -0
- models_ms/rose_perguntas.pth +3 -0
- models_ms/rose_perguntas_link +1 -0
- models_ms/speaker_embeddings_rose.pt +3 -0
- ms_pt_br_vits2.json +62 -0
- preprocess.py +142 -0
- requests.log +510 -0
- requirements.txt +93 -0
- rose_tts_api/__init__.py +0 -0
- rose_tts_api/__pycache__/__init__.cpython-311.pyc +0 -0
- rose_tts_api/__pycache__/handlers.cpython-311.pyc +0 -0
- rose_tts_api/__pycache__/middlewares.cpython-311.pyc +0 -0
- rose_tts_api/__pycache__/settings.cpython-311.pyc +0 -0
- rose_tts_api/__pycache__/urls.cpython-311.pyc +0 -0
- rose_tts_api/__pycache__/wsgi.cpython-311.pyc +0 -0
- rose_tts_api/asgi.py +16 -0
- rose_tts_api/auth.json +13 -0
- rose_tts_api/handlers.py +72 -0
- rose_tts_api/middlewares.py +25 -0
- rose_tts_api/settings.py +220 -0
- rose_tts_api/urls.py +52 -0
- rose_tts_api/wsgi.py +16 -0
- rose_tts_hodc.py +243 -0
- tts/__init__.py +0 -0
- tts/__pycache__/__init__.cpython-311.pyc +0 -0
- tts/__pycache__/admin.cpython-311.pyc +0 -0
- tts/__pycache__/apps.cpython-311.pyc +0 -0
- tts/__pycache__/models.cpython-311.pyc +0 -0
- tts/__pycache__/serializers.cpython-311.pyc +0 -0
- tts/__pycache__/urls.cpython-311.pyc +0 -0
- tts/__pycache__/views.cpython-311.pyc +0 -0
- tts/admin.py +3 -0
- tts/apps.py +32 -0
- tts/migrations/__init__.py +0 -0
- tts/migrations/__pycache__/__init__.cpython-311.pyc +0 -0
- tts/models.py +3 -0
- tts/serializers.py +28 -0
- tts/tests.py +3 -0
- tts/urls.py +25 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
db.sqlite3 filter=lfs diff=lfs merge=lfs -text
|
Dockerfile
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM fathos82/intel-extension-for-pytorch:v1.0
|
| 2 |
+
ENV PATH="/root/miniforge3/envs/py310/bin:$PATH"
|
| 3 |
+
|
| 4 |
+
# Dependências da sua API
|
| 5 |
+
RUN apt-get update && \
|
| 6 |
+
apt-get install -y --no-install-recommends \
|
| 7 |
+
libpq-dev gcc curl python3-dev musl-dev espeak \
|
| 8 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
+
|
| 10 |
+
# WORKDIR da sua API
|
| 11 |
+
WORKDIR /usr/src/app
|
| 12 |
+
|
| 13 |
+
# Instalação do seu projetoz
|
| 14 |
+
COPY requirements.txt .
|
| 15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
# Installing 'resemblyzer' without dependencies using '--no-deps' to prevent it from overwriting
|
| 19 |
+
# the currently installed version of PyTorch (pytorch + cpu). Other dependencies such as librosa, numpy, scipy,
|
| 20 |
+
# typing, and webrtcvad are being installed normally in the 'requirements.txt' file.
|
| 21 |
+
RUN pip install --no-cache-dir --no-deps Resemblyzer==0.1.4
|
| 22 |
+
|
| 23 |
+
RUN chmod +x /usr/local/bin/entrypoint.sh
|
| 24 |
+
|
| 25 |
+
COPY . .
|
| 26 |
+
# Configurações finais'
|
| 27 |
+
#ENV GUNICORN_WORKERS=1
|
| 28 |
+
EXPOSE 8000
|
| 29 |
+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
| 30 |
+
CMD ["sh", "-c", "gunicorn --log-level=warning --access-logfile - --error-logfile - rose_tts_api.wsgi:application --workers $GUNICORN_WORKERS --timeout 70 --bind 0.0.0.0:8000"]
|
| 31 |
+
|
| 32 |
+
# CASO FOR SUBIR ESSA VERSÃO ADICIONAR PYTORCH EM requirements.txt
|
| 33 |
+
|
| 34 |
+
# FROM python:3.11-slim
|
| 35 |
+
|
| 36 |
+
# # Definindo a variável de ambiente corretamente
|
| 37 |
+
# ENV GUNICORN_WORKERS=1
|
| 38 |
+
|
| 39 |
+
# # Instalação de dependências do sistema
|
| 40 |
+
# RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 41 |
+
# libpq-dev gcc curl python3-dev musl-dev \
|
| 42 |
+
# && apt-get install -y espeak \
|
| 43 |
+
# && rm -rf /var/lib/apt/lists/*
|
| 44 |
+
|
| 45 |
+
# WORKDIR /usr/src/app
|
| 46 |
+
|
| 47 |
+
# # Copia o arquivo de dependências e instala
|
| 48 |
+
# COPY requirements.txt ./
|
| 49 |
+
# RUN pip install --no-cache-dir -r requirements.txt
|
| 50 |
+
|
| 51 |
+
# # Copia o código do projeto
|
| 52 |
+
# COPY . .
|
| 53 |
+
|
| 54 |
+
# # Expondo a porta 8000 para o Gunicorn
|
| 55 |
+
# EXPOSE 8000
|
| 56 |
+
|
| 57 |
+
# # Comando para iniciar o servidor com Gunicorn, usando 'sh -c' para interpolação correta da variável
|
| 58 |
+
# CMD ["sh", "-c", "gunicorn --log-level=warning --access-logfile - --error-logfile - rose_tts_api.wsgi:application --workers $GUNICORN_WORKERS --timeout 70 --bind 0.0.0.0:8000"]
|
__pycache__/preprocess.cpython-311.pyc
ADDED
|
Binary file (1.6 kB). View file
|
|
|
__pycache__/rose_tts_hodc.cpython-311.pyc
ADDED
|
Binary file (9.7 kB). View file
|
|
|
db.sqlite3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:178f3252bd70a6b5d5b919753ab71e7e46ec035222d0b496a3f66567ccf0abdc
|
| 3 |
+
size 143360
|
docker-compose.yml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
local-rose-tts-api:
|
| 3 |
+
volumes:
|
| 4 |
+
- ./:/usr/src/app
|
| 5 |
+
build:
|
| 6 |
+
context: .
|
| 7 |
+
dockerfile: Dockerfile
|
| 8 |
+
ports:
|
| 9 |
+
- "8000:8000"
|
| 10 |
+
environment:
|
| 11 |
+
DEBUG: "True"
|
| 12 |
+
ALLOWED_HOSTS: "localhost"
|
| 13 |
+
CASH_MODEL_TIME: "18000"
|
| 14 |
+
ACTIVATE_MODEL_ON_START: "True"
|
| 15 |
+
GUNICORN_WORKERS: "3"
|
| 16 |
+
restart: unless-stopped
|
error.log
ADDED
|
File without changes
|
manage.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
"""Django's command-line utility for administrative tasks."""
|
| 3 |
+
import os
|
| 4 |
+
import sys
|
| 5 |
+
# rose_tts_api/wsgi.py (ou outro arquivo principal)
|
| 6 |
+
# import torch
|
| 7 |
+
# import intel_extension_for_pytorch as ipex
|
| 8 |
+
#
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
# Crie um usuário primeiro, caso ainda não exista
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def main():
|
| 15 |
+
|
| 16 |
+
"""Run administrative tasks."""
|
| 17 |
+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'rose_tts_api.settings')
|
| 18 |
+
try:
|
| 19 |
+
from django.core.management import execute_from_command_line
|
| 20 |
+
except ImportError as exc:
|
| 21 |
+
raise ImportError(
|
| 22 |
+
"Couldn't import Django. Are you sure it's installed and "
|
| 23 |
+
"available on your PYTHONPATH environment variable? Did you "
|
| 24 |
+
"forget to activate a virtual environment?"
|
| 25 |
+
) from exc
|
| 26 |
+
|
| 27 |
+
execute_from_command_line(sys.argv)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
if __name__ == '__main__':
|
| 32 |
+
main()
|
models_ms/embeddings.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"models_ms/mtsp3_G.pth": "models_ms/mtsp3_speaker_embeddings.pt",
|
| 3 |
+
"models_ms/mtsp4_G.pth": "models_ms/mtsp4_speaker_embeddings.pt",
|
| 4 |
+
"models_ms/mtsp5_G.pth": "models_ms/mtsp5_speaker_embeddings.pt",
|
| 5 |
+
"models_ms/multispeaker": "models_ms/multispeaker_speaker_embeddings.pt",
|
| 6 |
+
"models_ms/rose_perguntas.pth": "models_ms/speaker_embeddings_rose.pt"
|
| 7 |
+
|
| 8 |
+
}
|
models_ms/multispeaker.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bc0b72647240068acf3405850b37dab1cebadce4479e4948962b6e6c5f5174bc
|
| 3 |
+
size 485669431
|
models_ms/multispeaker_link
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Contact to Developer
|
models_ms/multispeaker_speaker_embeddings.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:62dcff062a163aea6072b2b5369eece9cc81a489dc8787a538ac5a047952ef87
|
| 3 |
+
size 44812
|
models_ms/rose_perguntas.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:42340f067f80d75da3f88fb345f2efc6a135e82314b3ca9efb6d07f8ad7a3d21
|
| 3 |
+
size 485669431
|
models_ms/rose_perguntas_link
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Contact to Developer
|
models_ms/speaker_embeddings_rose.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a58ce14a88e637e7d437bbf42a17d52d8f3e443db73b8e437399b075caed0716
|
| 3 |
+
size 45406
|
ms_pt_br_vits2.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"train": {
|
| 3 |
+
"log_interval": 50,
|
| 4 |
+
"eval_interval": 2000,
|
| 5 |
+
"seed": 1234,
|
| 6 |
+
"epochs": 10000,
|
| 7 |
+
"learning_rate": 2e-4,
|
| 8 |
+
"betas": [0.8, 0.99],
|
| 9 |
+
"eps": 1e-9,
|
| 10 |
+
"batch_size": 24,
|
| 11 |
+
"fp16_run": true,
|
| 12 |
+
"lr_decay": 0.999875,
|
| 13 |
+
"segment_size": 8192,
|
| 14 |
+
"init_lr_ratio": 1,
|
| 15 |
+
"warmup_epochs": 0,
|
| 16 |
+
"c_mel": 45,
|
| 17 |
+
"c_kl": 1.0
|
| 18 |
+
},
|
| 19 |
+
"data": {
|
| 20 |
+
"use_mel_posterior_encoder": true,
|
| 21 |
+
"training_files":"/var/truenas/code/vits/filelists_ms/filelist_train.txt.cleaned",
|
| 22 |
+
"validation_files":"/var/truenas/code/vits/filelists_ms/filelist_val.txt.cleaned",
|
| 23 |
+
"text_cleaners":["no_cleaners"],
|
| 24 |
+
"max_wav_value": 32768.0,
|
| 25 |
+
"sampling_rate": 22050,
|
| 26 |
+
"filter_length": 1024,
|
| 27 |
+
"hop_length": 256,
|
| 28 |
+
"win_length": 1024,
|
| 29 |
+
"n_mel_channels": 80,
|
| 30 |
+
"mel_fmin": 0.0,
|
| 31 |
+
"mel_fmax": null,
|
| 32 |
+
"add_blank": false,
|
| 33 |
+
"n_speakers": 109,
|
| 34 |
+
"cleaned_text": true
|
| 35 |
+
},
|
| 36 |
+
"model": {
|
| 37 |
+
"use_mel_posterior_encoder": true,
|
| 38 |
+
"use_transformer_flows": true,
|
| 39 |
+
"transformer_flow_type": "pre_conv",
|
| 40 |
+
"use_spk_conditioned_encoder": true,
|
| 41 |
+
"use_noise_scaled_mas": true,
|
| 42 |
+
"use_duration_discriminator": true,
|
| 43 |
+
"inter_channels": 192,
|
| 44 |
+
"hidden_channels": 192,
|
| 45 |
+
"filter_channels": 768,
|
| 46 |
+
"n_heads": 2,
|
| 47 |
+
"n_layers": 6,
|
| 48 |
+
"kernel_size": 3,
|
| 49 |
+
"p_dropout": 0.1,
|
| 50 |
+
"resblock": "1",
|
| 51 |
+
"resblock_kernel_sizes": [3,7,11],
|
| 52 |
+
"resblock_dilation_sizes": [[1,3,5], [1,3,5], [1,3,5]],
|
| 53 |
+
"upsample_rates": [8,8,2,2],
|
| 54 |
+
"upsample_initial_channel": 512,
|
| 55 |
+
"upsample_kernel_sizes": [16,16,4,4],
|
| 56 |
+
"n_layers_q": 3,
|
| 57 |
+
"use_spectral_norm": false,
|
| 58 |
+
"use_sdp": false,
|
| 59 |
+
"gin_channels": 256
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
|
preprocess.py
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# import pandas as pd
|
| 2 |
+
# import os
|
| 3 |
+
# import shutil
|
| 4 |
+
# import subprocess
|
| 5 |
+
# import multiprocessing
|
| 6 |
+
# from tqdm import tqdm
|
| 7 |
+
# from pathlib import Path
|
| 8 |
+
# import numpy as np
|
| 9 |
+
# from sklearn.model_selection import train_test_split
|
| 10 |
+
# from vits2.text.symbols import symbols
|
| 11 |
+
# import vits2.utils as utils
|
| 12 |
+
|
| 13 |
+
import torch
|
| 14 |
+
import json
|
| 15 |
+
from phonemizer.backend import EspeakBackend
|
| 16 |
+
|
| 17 |
+
from vits2.text import text_to_sequence
|
| 18 |
+
import vits2.commons as commons
|
| 19 |
+
|
| 20 |
+
# TODO: EDITED BY fathos82
|
| 21 |
+
# ADD tts/
|
| 22 |
+
with open('ms_pt_br_vits2.json', "r") as f:
|
| 23 |
+
data = f.read()
|
| 24 |
+
training_hparams_json= json.loads(data)
|
| 25 |
+
|
| 26 |
+
# TODO: Edited by @fathos82: Unnecessary code, it causes a problem with pytorch from source dependency
|
| 27 |
+
# from resemblyzer import VoiceEncoder
|
| 28 |
+
# encoder = VoiceEncoder()
|
| 29 |
+
|
| 30 |
+
backend = EspeakBackend('pt-br',preserve_punctuation=True,with_stress=True)
|
| 31 |
+
|
| 32 |
+
def text_to_IPA(sentence):
|
| 33 |
+
return backend.phonemize([sentence])[0].rstrip()
|
| 34 |
+
def get_text(text, hps):
|
| 35 |
+
text_norm = text_to_sequence(text, hps.data.text_cleaners)
|
| 36 |
+
if hps.data.add_blank:
|
| 37 |
+
text_norm = commons.intersperse(text_norm, 0)
|
| 38 |
+
text_norm = torch.LongTensor(text_norm)
|
| 39 |
+
return text_norm
|
| 40 |
+
|
| 41 |
+
# TODO: EDITED BY fathos82
|
| 42 |
+
# WARN: Below is a list of functions that are not used in rose hocd, that is, useless.
|
| 43 |
+
|
| 44 |
+
# def preprocess_tts_training(csv_path, output_folder,audio_column='wav_paths',text_column='texts',spk_ids_column='', pretrained_g=None, pretrained_d=None):
|
| 45 |
+
# data = []
|
| 46 |
+
# read_df = pd.read_csv(csv_path)
|
| 47 |
+
# os.makedirs(output_folder, exist_ok=True)
|
| 48 |
+
# if os.path.exists(pretrained_g):
|
| 49 |
+
# os.makedirs(output_folder + '/logs', exist_ok=True)
|
| 50 |
+
# shutil.copy(pretrained_g, output_folder + '/logs/G_1.pth')
|
| 51 |
+
# if os.path.exists(pretrained_d):
|
| 52 |
+
# os.makedirs(output_folder + '/logs', exist_ok=True)
|
| 53 |
+
# shutil.copy(pretrained_d, output_folder + '/logs/D_1.pth')
|
| 54 |
+
#
|
| 55 |
+
# audiopaths = read_df[audio_column].tolist()
|
| 56 |
+
# new_audiopaths = convert_wavs(audiopaths,output_folder)
|
| 57 |
+
# text = read_df[text_column].tolist()
|
| 58 |
+
# if not spk_ids_column:
|
| 59 |
+
# spk_ids = None
|
| 60 |
+
# else:
|
| 61 |
+
# spk_ids = read_df[spk_ids_column].tolist()
|
| 62 |
+
# audiopaths_per_spk_id = get_audiopaths_per_spk_id(new_audiopaths, spk_ids)
|
| 63 |
+
# generate_embeddings_for_training(audiopaths_per_spk_id ,output_folder)
|
| 64 |
+
# generate_formatted_metadata(new_audiopaths,text,output_folder,spk_ids=spk_ids)
|
| 65 |
+
# print('Preprocessing done!')
|
| 66 |
+
# gr.Info("Preprocessing finished, you can start training!")
|
| 67 |
+
# return None
|
| 68 |
+
#
|
| 69 |
+
# def get_audiopaths_per_spk_id(audiopaths, spk_ids= None):
|
| 70 |
+
# audiopaths_per_spk_id = {}
|
| 71 |
+
# if not spk_ids:
|
| 72 |
+
# spk_ids = [0] * len(audiopaths)
|
| 73 |
+
# for i, audiopath in enumerate(audiopaths):
|
| 74 |
+
# audiopaths_per_spk_id[spk_ids[i]] = audiopaths_per_spk_id.get(spk_ids[i], []) + [audiopath]
|
| 75 |
+
# return audiopaths_per_spk_id
|
| 76 |
+
#
|
| 77 |
+
#
|
| 78 |
+
# def convert_wav(audiopath, basename, wavs_folder):
|
| 79 |
+
# subprocess.Popen(f"sox {audiopath} -b 16 -r 22050 -c 1 norm -1 {wavs_folder}/{basename}", shell=True, stdout=subprocess.PIPE).stdout.read()
|
| 80 |
+
#
|
| 81 |
+
# def convert_wavs(audiopaths,output_folder):
|
| 82 |
+
# print('converting wavs to 22050 Hz / 16 bit / mono...')
|
| 83 |
+
# basenames = [os.path.basename(audiopath) for audiopath in audiopaths]
|
| 84 |
+
# wavs_folder = output_folder + '/wavs'
|
| 85 |
+
# os.makedirs(wavs_folder, exist_ok=True)
|
| 86 |
+
# pool = multiprocessing.Pool()
|
| 87 |
+
# results = []
|
| 88 |
+
# for audiopath, basename in tqdm(zip(audiopaths, basenames), total=len(audiopaths)):
|
| 89 |
+
# result = pool.apply_async(convert_wav, (audiopath, basename, wavs_folder))
|
| 90 |
+
# results.append(result)
|
| 91 |
+
#
|
| 92 |
+
# pool.close()
|
| 93 |
+
# pool.join()
|
| 94 |
+
#
|
| 95 |
+
# for result in results:
|
| 96 |
+
# result.get()
|
| 97 |
+
# return [f'{wavs_folder}/{os.path.basename(audiopath)}' for audiopath in audiopaths]
|
| 98 |
+
#
|
| 99 |
+
# def generate_embeddings_for_training(audiopaths_per_spk_id,output_folder):
|
| 100 |
+
# print('generating speaker embeddings...')
|
| 101 |
+
# speaker_embeddings = []
|
| 102 |
+
# for spk_id in audiopaths_per_spk_id.keys():
|
| 103 |
+
# audiopaths = audiopaths_per_spk_id[spk_id]
|
| 104 |
+
# embeds = []
|
| 105 |
+
# for audiopath in tqdm(audiopaths[:50]):
|
| 106 |
+
# fpath = Path(audiopath)
|
| 107 |
+
# wav = preprocess_wav(fpath)
|
| 108 |
+
# embeds.append(encoder.embed_utterance(wav))
|
| 109 |
+
# if len(embeds) > 1:
|
| 110 |
+
# custom_embedding = torch.tensor(np.median(embeds,axis=0))
|
| 111 |
+
# else:
|
| 112 |
+
# custom_embedding = torch.tensor(embeds[0])
|
| 113 |
+
# speaker_embeddings.append(torch.FloatTensor(custom_embedding))
|
| 114 |
+
# speaker_embeddings = torch.stack(speaker_embeddings)
|
| 115 |
+
# torch.save(speaker_embeddings, output_folder + '/speaker_embeddings.pt')
|
| 116 |
+
# return None
|
| 117 |
+
#
|
| 118 |
+
# def generate_formatted_metadata(audiopaths,text,output_folder, spk_ids = None):
|
| 119 |
+
# print('converting csvs...')
|
| 120 |
+
#
|
| 121 |
+
#
|
| 122 |
+
# with multiprocessing.Pool() as pool:
|
| 123 |
+
# phonemes = list(tqdm(pool.imap(text_to_IPA, text), total=len(text)))
|
| 124 |
+
# df = pd.DataFrame()
|
| 125 |
+
# df['paths'] = audiopaths
|
| 126 |
+
# if not spk_ids:
|
| 127 |
+
# df['spk_id'] = [0] * len(audiopaths)
|
| 128 |
+
# else:
|
| 129 |
+
# df['spk_id'] = spk_ids
|
| 130 |
+
# df['phonemes'] = phonemes
|
| 131 |
+
# train_df, test_df = train_test_split(df, test_size=0.05, random_state=42)
|
| 132 |
+
# test_df, val_df = train_test_split(test_df, test_size=0.9, random_state=42)
|
| 133 |
+
# train_df.to_csv(output_folder + '/filelist_train.txt', index=False, header=False, sep='|')
|
| 134 |
+
# test_df.to_csv(output_folder + '/filelist_test.txt', index=False, header=False, sep='|')
|
| 135 |
+
# val_df.to_csv(output_folder + '/filelist_val.txt', index=False, header=False, sep='|')
|
| 136 |
+
# training_hparams_json['data']['training_files'] = output_folder + '/filelist_train.txt'
|
| 137 |
+
# training_hparams_json['data']["validation_files"] = output_folder + '/filelist_val.txt'
|
| 138 |
+
# training_hparams_json['model']['speaker_embeddings_path'] = output_folder + '/speaker_embeddings.pt'
|
| 139 |
+
# json.dump(training_hparams_json, open(output_folder + '/config.json', 'w'))
|
| 140 |
+
#
|
| 141 |
+
# return None
|
| 142 |
+
#
|
requests.log
ADDED
|
@@ -0,0 +1,510 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
speech_settingsINFO 2025-02-11 13:50:16,798 Request: GET / - IP: 127.0.0.1
|
| 2 |
+
INFO 2025-02-11 13:50:16,803 Response: 404, Time: 0.004s
|
| 3 |
+
Body: None
|
| 4 |
+
INFO 2025-02-11 13:50:18,106 Request: GET /favicon.ico - IP: 127.0.0.1
|
| 5 |
+
INFO 2025-02-11 13:50:18,106 Response: 404, Time: 0.000s
|
| 6 |
+
Body: None
|
| 7 |
+
INFO 2025-02-11 13:50:42,311 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 8 |
+
INFO 2025-02-11 13:50:42,312 Response: 404, Time: 0.001s
|
| 9 |
+
Body: None
|
| 10 |
+
INFO 2025-02-11 13:50:52,173 Request: GET /api/predict/ - IP: 127.0.0.1
|
| 11 |
+
INFO 2025-02-11 13:50:52,174 Response: 404, Time: 0.000s
|
| 12 |
+
Body: None
|
| 13 |
+
INFO 2025-02-11 13:51:01,224 Request: GET /api/predict - IP: 127.0.0.1
|
| 14 |
+
INFO 2025-02-11 13:51:01,224 Response: 404, Time: 0.000s
|
| 15 |
+
Body: None
|
| 16 |
+
INFO 2025-02-11 13:51:24,577 Request: GET /api/predict - IP: 127.0.0.1
|
| 17 |
+
INFO 2025-02-11 13:51:24,580 Response: 404, Time: 0.002s
|
| 18 |
+
Body: None
|
| 19 |
+
INFO 2025-02-11 13:51:25,321 Request: GET /api/predict - IP: 127.0.0.1
|
| 20 |
+
INFO 2025-02-11 13:51:25,322 Response: 404, Time: 0.001s
|
| 21 |
+
Body: None
|
| 22 |
+
INFO 2025-02-11 13:51:25,933 Request: GET /api/predict - IP: 127.0.0.1
|
| 23 |
+
INFO 2025-02-11 13:51:25,935 Response: 404, Time: 0.002s
|
| 24 |
+
Body: None
|
| 25 |
+
INFO 2025-02-11 13:51:26,487 Request: GET /api/predict - IP: 127.0.0.1
|
| 26 |
+
INFO 2025-02-11 13:51:26,489 Response: 404, Time: 0.001s
|
| 27 |
+
Body: None
|
| 28 |
+
INFO 2025-02-11 13:56:06,270 Request: GET /api/predict - IP: 127.0.0.1
|
| 29 |
+
INFO 2025-02-11 13:56:06,290 Response: 404, Time: 0.019s
|
| 30 |
+
Body: None
|
| 31 |
+
INFO 2025-02-11 13:56:06,942 Request: GET /api/predict - IP: 127.0.0.1
|
| 32 |
+
INFO 2025-02-11 13:56:06,955 Response: 404, Time: 0.012s
|
| 33 |
+
Body: None
|
| 34 |
+
INFO 2025-02-11 13:56:14,620 Request: GET /api/predict/ - IP: 127.0.0.1
|
| 35 |
+
INFO 2025-02-11 13:56:14,631 Response: 404, Time: 0.011s
|
| 36 |
+
Body: None
|
| 37 |
+
INFO 2025-02-11 13:56:21,600 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 38 |
+
INFO 2025-02-11 13:56:21,602 Response: 401, Time: 0.002s
|
| 39 |
+
Body: None
|
| 40 |
+
INFO 2025-02-11 13:57:08,226 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 41 |
+
INFO 2025-02-11 13:57:08,502 Response: 500, Time: 0.276s
|
| 42 |
+
Body: None
|
| 43 |
+
INFO 2025-02-11 13:58:22,515 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 44 |
+
INFO 2025-02-11 13:58:22,731 Response: 500, Time: 0.216s
|
| 45 |
+
Body: None
|
| 46 |
+
INFO 2025-02-11 13:59:06,879 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 47 |
+
INFO 2025-02-11 13:59:07,122 Response: 500, Time: 0.242s
|
| 48 |
+
Body: None
|
| 49 |
+
INFO 2025-02-11 14:12:27,711 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 50 |
+
INFO 2025-02-11 14:12:27,954 Response: 500, Time: 0.243s
|
| 51 |
+
Body: None
|
| 52 |
+
INFO 2025-02-11 14:13:12,748 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 53 |
+
INFO 2025-02-11 14:13:13,002 Response: 500, Time: 0.253s
|
| 54 |
+
Body: None
|
| 55 |
+
INFO 2025-02-11 14:14:00,267 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 56 |
+
INFO 2025-02-11 14:14:00,373 Response: 500, Time: 0.107s
|
| 57 |
+
Body: None
|
| 58 |
+
INFO 2025-02-13 14:52:33,771 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 59 |
+
INFO 2025-02-13 14:52:33,774 Response: 404, Time: 0.002s
|
| 60 |
+
Body: None
|
| 61 |
+
INFO 2025-02-13 14:53:01,550 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 62 |
+
INFO 2025-02-13 14:53:01,563 Response: 405, Time: 0.012s
|
| 63 |
+
Body: None
|
| 64 |
+
INFO 2025-02-13 14:53:46,402 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 65 |
+
INFO 2025-02-13 14:53:46,433 Response: 500, Time: 0.031s
|
| 66 |
+
Body: None
|
| 67 |
+
INFO 2025-02-13 14:53:46,676 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 68 |
+
INFO 2025-02-13 14:53:46,705 Response: 500, Time: 0.029s
|
| 69 |
+
Body: None
|
| 70 |
+
INFO 2025-02-13 14:53:46,832 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 71 |
+
INFO 2025-02-13 14:53:46,853 Response: 500, Time: 0.021s
|
| 72 |
+
Body: None
|
| 73 |
+
INFO 2025-02-13 14:53:46,933 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 74 |
+
INFO 2025-02-13 14:53:46,962 Response: 500, Time: 0.029s
|
| 75 |
+
Body: None
|
| 76 |
+
INFO 2025-02-13 15:00:31,208 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 77 |
+
INFO 2025-02-13 15:00:31,309 Response: 500, Time: 0.101s
|
| 78 |
+
Body: None
|
| 79 |
+
INFO 2025-02-13 15:02:35,753 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 80 |
+
INFO 2025-02-13 15:02:35,776 Response: 500, Time: 0.023s
|
| 81 |
+
Body: None
|
| 82 |
+
INFO 2025-02-13 15:03:40,009 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 83 |
+
INFO 2025-02-13 15:03:40,038 Response: 500, Time: 0.029s
|
| 84 |
+
Body: None
|
| 85 |
+
INFO 2025-02-13 15:03:40,685 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 86 |
+
INFO 2025-02-13 15:03:40,706 Response: 500, Time: 0.021s
|
| 87 |
+
Body: None
|
| 88 |
+
INFO 2025-02-13 15:04:17,630 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 89 |
+
INFO 2025-02-13 15:04:17,737 Response: 500, Time: 0.107s
|
| 90 |
+
Body: None
|
| 91 |
+
INFO 2025-02-13 15:04:18,399 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 92 |
+
INFO 2025-02-13 15:04:18,471 Response: 500, Time: 0.072s
|
| 93 |
+
Body: None
|
| 94 |
+
INFO 2025-02-13 15:04:43,062 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 95 |
+
INFO 2025-02-13 15:04:56,656 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 96 |
+
INFO 2025-02-13 15:10:43,347 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 97 |
+
INFO 2025-02-13 15:10:43,373 Response: 500, Time: 0.027s
|
| 98 |
+
Body: None
|
| 99 |
+
INFO 2025-02-13 15:16:27,049 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 100 |
+
INFO 2025-02-13 15:16:27,132 Response: 500, Time: 0.082s
|
| 101 |
+
Body: None
|
| 102 |
+
INFO 2025-02-13 15:16:27,932 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 103 |
+
INFO 2025-02-13 15:16:28,012 Response: 500, Time: 0.080s
|
| 104 |
+
Body: None
|
| 105 |
+
INFO 2025-02-13 15:17:19,610 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 106 |
+
INFO 2025-02-13 15:17:22,068 Response: 500, Time: 2.457s
|
| 107 |
+
Body: None
|
| 108 |
+
INFO 2025-02-13 15:22:19,951 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 109 |
+
INFO 2025-02-13 15:22:20,043 Response: 500, Time: 0.092s
|
| 110 |
+
Body: None
|
| 111 |
+
INFO 2025-02-13 15:29:26,928 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 112 |
+
INFO 2025-02-13 15:29:26,944 Response: 500, Time: 0.016s
|
| 113 |
+
Body: None
|
| 114 |
+
INFO 2025-02-13 15:29:46,915 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 115 |
+
INFO 2025-02-13 15:29:47,011 Response: 500, Time: 0.096s
|
| 116 |
+
Body: None
|
| 117 |
+
INFO 2025-02-13 15:30:29,259 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 118 |
+
INFO 2025-02-13 15:30:29,354 Response: 500, Time: 0.095s
|
| 119 |
+
Body: None
|
| 120 |
+
INFO 2025-02-13 15:30:30,352 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 121 |
+
INFO 2025-02-13 15:30:30,528 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 122 |
+
INFO 2025-02-13 15:30:30,573 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 123 |
+
INFO 2025-02-13 15:30:30,661 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 124 |
+
INFO 2025-02-13 15:30:30,951 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 125 |
+
INFO 2025-02-13 15:30:31,709 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 126 |
+
INFO 2025-02-13 15:30:31,712 Response: 500, Time: 1.359s
|
| 127 |
+
Body: None
|
| 128 |
+
INFO 2025-02-13 15:30:31,716 Response: 500, Time: 1.188s
|
| 129 |
+
Body: None
|
| 130 |
+
INFO 2025-02-13 15:30:31,730 Response: 500, Time: 1.157s
|
| 131 |
+
Body: None
|
| 132 |
+
INFO 2025-02-13 15:30:31,760 Response: 500, Time: 1.098s
|
| 133 |
+
Body: None
|
| 134 |
+
INFO 2025-02-13 15:30:31,767 Response: 500, Time: 0.816s
|
| 135 |
+
Body: None
|
| 136 |
+
INFO 2025-02-13 15:30:45,676 Response: 500, Time: 13.966s
|
| 137 |
+
Body: None
|
| 138 |
+
INFO 2025-02-13 15:35:31,808 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 139 |
+
INFO 2025-02-13 15:35:31,906 Response: 500, Time: 0.097s
|
| 140 |
+
Body: None
|
| 141 |
+
INFO 2025-02-13 15:35:57,350 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 142 |
+
INFO 2025-02-13 15:35:57,397 Response: 500, Time: 0.047s
|
| 143 |
+
Body: None
|
| 144 |
+
INFO 2025-02-13 15:36:46,713 Request: GET /api/predict/test-error - IP: 127.0.0.1
|
| 145 |
+
INFO 2025-02-13 15:36:46,740 Response: 500, Time: 0.027s
|
| 146 |
+
Body: None
|
| 147 |
+
ERROR 2025-02-13 16:02:52,522 Internal Server Error: /api/predict/test-error
|
| 148 |
+
Traceback (most recent call last):
|
| 149 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
|
| 150 |
+
response = get_response(request)
|
| 151 |
+
^^^^^^^^^^^^^^^^^^^^^
|
| 152 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
|
| 153 |
+
response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
| 154 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 155 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
|
| 156 |
+
return view_func(request, *args, **kwargs)
|
| 157 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 158 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
|
| 159 |
+
return self.dispatch(request, *args, **kwargs)
|
| 160 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 161 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
|
| 162 |
+
response = self.handle_exception(exc)
|
| 163 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 164 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
|
| 165 |
+
self.raise_uncaught_exception(exc)
|
| 166 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
|
| 167 |
+
raise exc
|
| 168 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
|
| 169 |
+
response = handler(request, *args, **kwargs)
|
| 170 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 171 |
+
File "/home/athos/PycharmProjects/rose_tts_api/tts/views.py", line 93, in get
|
| 172 |
+
raise RuntimeError("Forcing Error")
|
| 173 |
+
RuntimeError: Forcing Error
|
| 174 |
+
ERROR 2025-02-13 16:02:52,524 "GET /api/predict/test-error HTTP/1.1" 500 91195
|
| 175 |
+
ERROR 2025-02-13 16:02:53,554 Internal Server Error: /api/predict/test-error
|
| 176 |
+
Traceback (most recent call last):
|
| 177 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
|
| 178 |
+
response = get_response(request)
|
| 179 |
+
^^^^^^^^^^^^^^^^^^^^^
|
| 180 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
|
| 181 |
+
response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
| 182 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 183 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
|
| 184 |
+
return view_func(request, *args, **kwargs)
|
| 185 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 186 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
|
| 187 |
+
return self.dispatch(request, *args, **kwargs)
|
| 188 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 189 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
|
| 190 |
+
response = self.handle_exception(exc)
|
| 191 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 192 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
|
| 193 |
+
self.raise_uncaught_exception(exc)
|
| 194 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
|
| 195 |
+
raise exc
|
| 196 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
|
| 197 |
+
response = handler(request, *args, **kwargs)
|
| 198 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 199 |
+
File "/home/athos/PycharmProjects/rose_tts_api/tts/views.py", line 93, in get
|
| 200 |
+
raise RuntimeError("Forcing Error")
|
| 201 |
+
RuntimeError: Forcing Error
|
| 202 |
+
ERROR 2025-02-13 16:02:53,557 "GET /api/predict/test-error HTTP/1.1" 500 91195
|
| 203 |
+
ERROR 2025-02-13 16:03:05,769 Internal Server Error: /api/predict/test-error
|
| 204 |
+
Traceback (most recent call last):
|
| 205 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
|
| 206 |
+
response = get_response(request)
|
| 207 |
+
^^^^^^^^^^^^^^^^^^^^^
|
| 208 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
|
| 209 |
+
response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
| 210 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 211 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
|
| 212 |
+
return view_func(request, *args, **kwargs)
|
| 213 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 214 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
|
| 215 |
+
return self.dispatch(request, *args, **kwargs)
|
| 216 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 217 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
|
| 218 |
+
response = self.handle_exception(exc)
|
| 219 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 220 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
|
| 221 |
+
self.raise_uncaught_exception(exc)
|
| 222 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
|
| 223 |
+
raise exc
|
| 224 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
|
| 225 |
+
response = handler(request, *args, **kwargs)
|
| 226 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 227 |
+
File "/home/athos/PycharmProjects/rose_tts_api/tts/views.py", line 93, in get
|
| 228 |
+
raise RuntimeError("Forcing Error")
|
| 229 |
+
RuntimeError: Forcing Error
|
| 230 |
+
ERROR 2025-02-13 16:03:05,772 "GET /api/predict/test-error HTTP/1.1" 500 91195
|
| 231 |
+
ERROR 2025-02-13 16:03:40,583 Internal Server Error: /api/predict/test-error
|
| 232 |
+
Traceback (most recent call last):
|
| 233 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
|
| 234 |
+
response = get_response(request)
|
| 235 |
+
^^^^^^^^^^^^^^^^^^^^^
|
| 236 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
|
| 237 |
+
response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
| 238 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 239 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
|
| 240 |
+
return view_func(request, *args, **kwargs)
|
| 241 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 242 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
|
| 243 |
+
return self.dispatch(request, *args, **kwargs)
|
| 244 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 245 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
|
| 246 |
+
response = self.handle_exception(exc)
|
| 247 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 248 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
|
| 249 |
+
self.raise_uncaught_exception(exc)
|
| 250 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
|
| 251 |
+
raise exc
|
| 252 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
|
| 253 |
+
response = handler(request, *args, **kwargs)
|
| 254 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 255 |
+
File "/home/athos/PycharmProjects/rose_tts_api/tts/views.py", line 93, in get
|
| 256 |
+
raise RuntimeError("Forcing Error")
|
| 257 |
+
RuntimeError: Forcing Error
|
| 258 |
+
ERROR 2025-02-13 16:03:40,593 "GET /api/predict/test-error HTTP/1.1" 500 91222
|
| 259 |
+
ERROR 2025-02-13 16:04:15,886 Internal Server Error: /api/predict/test-error
|
| 260 |
+
Traceback (most recent call last):
|
| 261 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
|
| 262 |
+
response = get_response(request)
|
| 263 |
+
^^^^^^^^^^^^^^^^^^^^^
|
| 264 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
|
| 265 |
+
response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
| 266 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 267 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
|
| 268 |
+
return view_func(request, *args, **kwargs)
|
| 269 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 270 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
|
| 271 |
+
return self.dispatch(request, *args, **kwargs)
|
| 272 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 273 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
|
| 274 |
+
response = self.handle_exception(exc)
|
| 275 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 276 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
|
| 277 |
+
self.raise_uncaught_exception(exc)
|
| 278 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
|
| 279 |
+
raise exc
|
| 280 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
|
| 281 |
+
response = handler(request, *args, **kwargs)
|
| 282 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 283 |
+
File "/home/athos/PycharmProjects/rose_tts_api/tts/views.py", line 93, in get
|
| 284 |
+
raise RuntimeError("Forcing Error")
|
| 285 |
+
RuntimeError: Forcing Error
|
| 286 |
+
ERROR 2025-02-13 16:04:15,890 "GET /api/predict/test-error HTTP/1.1" 500 91222
|
| 287 |
+
ERROR 2025-02-13 16:04:16,871 Internal Server Error: /api/predict/test-error
|
| 288 |
+
Traceback (most recent call last):
|
| 289 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
|
| 290 |
+
response = get_response(request)
|
| 291 |
+
^^^^^^^^^^^^^^^^^^^^^
|
| 292 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
|
| 293 |
+
response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
| 294 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 295 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
|
| 296 |
+
return view_func(request, *args, **kwargs)
|
| 297 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 298 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
|
| 299 |
+
return self.dispatch(request, *args, **kwargs)
|
| 300 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 301 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
|
| 302 |
+
response = self.handle_exception(exc)
|
| 303 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 304 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
|
| 305 |
+
self.raise_uncaught_exception(exc)
|
| 306 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
|
| 307 |
+
raise exc
|
| 308 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
|
| 309 |
+
response = handler(request, *args, **kwargs)
|
| 310 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 311 |
+
File "/home/athos/PycharmProjects/rose_tts_api/tts/views.py", line 93, in get
|
| 312 |
+
raise RuntimeError("Forcing Error")
|
| 313 |
+
RuntimeError: Forcing Error
|
| 314 |
+
ERROR 2025-02-13 16:04:16,875 "GET /api/predict/test-error HTTP/1.1" 500 91222
|
| 315 |
+
ERROR 2025-02-13 16:04:47,694 Internal Server Error: /api/predict/test-error
|
| 316 |
+
Traceback (most recent call last):
|
| 317 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
|
| 318 |
+
response = get_response(request)
|
| 319 |
+
^^^^^^^^^^^^^^^^^^^^^
|
| 320 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
|
| 321 |
+
response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
| 322 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 323 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
|
| 324 |
+
return view_func(request, *args, **kwargs)
|
| 325 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 326 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
|
| 327 |
+
return self.dispatch(request, *args, **kwargs)
|
| 328 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 329 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
|
| 330 |
+
response = self.handle_exception(exc)
|
| 331 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 332 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
|
| 333 |
+
self.raise_uncaught_exception(exc)
|
| 334 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
|
| 335 |
+
raise exc
|
| 336 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
|
| 337 |
+
response = handler(request, *args, **kwargs)
|
| 338 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 339 |
+
File "/home/athos/PycharmProjects/rose_tts_api/tts/views.py", line 93, in get
|
| 340 |
+
raise RuntimeError("Forcing Error")
|
| 341 |
+
RuntimeError: Forcing Error
|
| 342 |
+
ERROR 2025-02-13 16:04:47,695 "GET /api/predict/test-error HTTP/1.1" 500 91220
|
| 343 |
+
ERROR 2025-02-13 16:04:49,975 Internal Server Error: /api/predict/test-error
|
| 344 |
+
Traceback (most recent call last):
|
| 345 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
|
| 346 |
+
response = get_response(request)
|
| 347 |
+
^^^^^^^^^^^^^^^^^^^^^
|
| 348 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
|
| 349 |
+
response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
| 350 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 351 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
|
| 352 |
+
return view_func(request, *args, **kwargs)
|
| 353 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 354 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
|
| 355 |
+
return self.dispatch(request, *args, **kwargs)
|
| 356 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 357 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
|
| 358 |
+
response = self.handle_exception(exc)
|
| 359 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 360 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
|
| 361 |
+
self.raise_uncaught_exception(exc)
|
| 362 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
|
| 363 |
+
raise exc
|
| 364 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
|
| 365 |
+
response = handler(request, *args, **kwargs)
|
| 366 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 367 |
+
File "/home/athos/PycharmProjects/rose_tts_api/tts/views.py", line 93, in get
|
| 368 |
+
raise RuntimeError("Forcing Error")
|
| 369 |
+
RuntimeError: Forcing Error
|
| 370 |
+
ERROR 2025-02-13 16:04:49,977 "GET /api/predict/test-error HTTP/1.1" 500 91220
|
| 371 |
+
ERROR 2025-02-13 16:05:19,387 Internal Server Error: /api/predict/test-error
|
| 372 |
+
Traceback (most recent call last):
|
| 373 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
|
| 374 |
+
response = get_response(request)
|
| 375 |
+
^^^^^^^^^^^^^^^^^^^^^
|
| 376 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
|
| 377 |
+
response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
| 378 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 379 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
|
| 380 |
+
return view_func(request, *args, **kwargs)
|
| 381 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 382 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
|
| 383 |
+
return self.dispatch(request, *args, **kwargs)
|
| 384 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 385 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
|
| 386 |
+
response = self.handle_exception(exc)
|
| 387 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 388 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
|
| 389 |
+
self.raise_uncaught_exception(exc)
|
| 390 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
|
| 391 |
+
raise exc
|
| 392 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
|
| 393 |
+
response = handler(request, *args, **kwargs)
|
| 394 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 395 |
+
File "/home/athos/PycharmProjects/rose_tts_api/tts/views.py", line 93, in get
|
| 396 |
+
raise RuntimeError("Forcing Error")
|
| 397 |
+
RuntimeError: Forcing Error
|
| 398 |
+
ERROR 2025-02-13 16:05:19,392 "GET /api/predict/test-error HTTP/1.1" 500 91220
|
| 399 |
+
ERROR 2025-02-13 16:05:41,627 Internal Server Error: /api/predict/test-error
|
| 400 |
+
Traceback (most recent call last):
|
| 401 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
|
| 402 |
+
response = get_response(request)
|
| 403 |
+
^^^^^^^^^^^^^^^^^^^^^
|
| 404 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
|
| 405 |
+
response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
| 406 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 407 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
|
| 408 |
+
return view_func(request, *args, **kwargs)
|
| 409 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 410 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
|
| 411 |
+
return self.dispatch(request, *args, **kwargs)
|
| 412 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 413 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
|
| 414 |
+
response = self.handle_exception(exc)
|
| 415 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 416 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
|
| 417 |
+
self.raise_uncaught_exception(exc)
|
| 418 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
|
| 419 |
+
raise exc
|
| 420 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
|
| 421 |
+
response = handler(request, *args, **kwargs)
|
| 422 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 423 |
+
File "/home/athos/PycharmProjects/rose_tts_api/tts/views.py", line 93, in get
|
| 424 |
+
raise RuntimeError("Forcing Error")
|
| 425 |
+
RuntimeError: Forcing Error
|
| 426 |
+
ERROR 2025-02-13 16:05:41,628 "GET /api/predict/test-error HTTP/1.1" 500 91220
|
| 427 |
+
ERROR 2025-02-13 16:06:36,171 Internal Server Error: /api/predict/test-error
|
| 428 |
+
Traceback (most recent call last):
|
| 429 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
|
| 430 |
+
response = get_response(request)
|
| 431 |
+
^^^^^^^^^^^^^^^^^^^^^
|
| 432 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
|
| 433 |
+
response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
| 434 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 435 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
|
| 436 |
+
return view_func(request, *args, **kwargs)
|
| 437 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 438 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
|
| 439 |
+
return self.dispatch(request, *args, **kwargs)
|
| 440 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 441 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
|
| 442 |
+
response = self.handle_exception(exc)
|
| 443 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 444 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
|
| 445 |
+
self.raise_uncaught_exception(exc)
|
| 446 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
|
| 447 |
+
raise exc
|
| 448 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
|
| 449 |
+
response = handler(request, *args, **kwargs)
|
| 450 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 451 |
+
File "/home/athos/PycharmProjects/rose_tts_api/tts/views.py", line 93, in get
|
| 452 |
+
raise RuntimeError("Forcing Error")
|
| 453 |
+
RuntimeError: Forcing Error
|
| 454 |
+
ERROR 2025-02-13 16:06:38,594 "GET /api/predict/test-error HTTP/1.1" 500 91220
|
| 455 |
+
ERROR 2025-02-13 16:14:03,513 Internal Server Error: /api/predict/test-error
|
| 456 |
+
Traceback (most recent call last):
|
| 457 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
|
| 458 |
+
response = get_response(request)
|
| 459 |
+
^^^^^^^^^^^^^^^^^^^^^
|
| 460 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
|
| 461 |
+
response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
| 462 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 463 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
|
| 464 |
+
return view_func(request, *args, **kwargs)
|
| 465 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 466 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
|
| 467 |
+
return self.dispatch(request, *args, **kwargs)
|
| 468 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 469 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
|
| 470 |
+
response = self.handle_exception(exc)
|
| 471 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 472 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
|
| 473 |
+
self.raise_uncaught_exception(exc)
|
| 474 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
|
| 475 |
+
raise exc
|
| 476 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
|
| 477 |
+
response = handler(request, *args, **kwargs)
|
| 478 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 479 |
+
File "/home/athos/PycharmProjects/rose_tts_api/tts/views.py", line 93, in get
|
| 480 |
+
raise RuntimeError("Forcing Error")
|
| 481 |
+
RuntimeError: Forcing Error
|
| 482 |
+
ERROR 2025-02-13 16:14:07,105 "GET /api/predict/test-error HTTP/1.1" 500 91220
|
| 483 |
+
ERROR 2025-02-13 16:15:16,901 Internal Server Error: /api/predict/test-error
|
| 484 |
+
Traceback (most recent call last):
|
| 485 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
|
| 486 |
+
response = get_response(request)
|
| 487 |
+
^^^^^^^^^^^^^^^^^^^^^
|
| 488 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
|
| 489 |
+
response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
| 490 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 491 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
|
| 492 |
+
return view_func(request, *args, **kwargs)
|
| 493 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 494 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
|
| 495 |
+
return self.dispatch(request, *args, **kwargs)
|
| 496 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 497 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
|
| 498 |
+
response = self.handle_exception(exc)
|
| 499 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 500 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
|
| 501 |
+
self.raise_uncaught_exception(exc)
|
| 502 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
|
| 503 |
+
raise exc
|
| 504 |
+
File "/home/athos/PycharmProjects/rose_tts_api/.venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
|
| 505 |
+
response = handler(request, *args, **kwargs)
|
| 506 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 507 |
+
File "/home/athos/PycharmProjects/rose_tts_api/tts/views.py", line 93, in get
|
| 508 |
+
raise RuntimeError("Forcing Error")
|
| 509 |
+
RuntimeError: Forcing Error
|
| 510 |
+
ERROR 2025-02-13 16:15:19,196 "GET /api/predict/test-error HTTP/1.1" 500 91220
|
requirements.txt
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
altgraph==0.17.4
|
| 2 |
+
anyio==4.6.0
|
| 3 |
+
asgiref==3.8.1
|
| 4 |
+
attrs==24.2.0
|
| 5 |
+
audioread==3.0.1
|
| 6 |
+
babel==2.16.0
|
| 7 |
+
bibtexparser==2.0.0b7
|
| 8 |
+
certifi==2024.8.30
|
| 9 |
+
cffi==1.17.0
|
| 10 |
+
charset-normalizer==3.3.2
|
| 11 |
+
clldutils==3.24.0
|
| 12 |
+
colorama==0.4.6
|
| 13 |
+
colorlog==6.9.0
|
| 14 |
+
coreschema==0.0.4
|
| 15 |
+
csvw==3.5.1
|
| 16 |
+
decorator==5.1.1
|
| 17 |
+
Django~=5.1.6
|
| 18 |
+
djangorestframework==3.15.2
|
| 19 |
+
dlinfo==1.2.1
|
| 20 |
+
drf-yasg==1.21.8
|
| 21 |
+
filelock==3.16.1
|
| 22 |
+
fsspec==2024.9.0
|
| 23 |
+
future==1.0.0
|
| 24 |
+
gradio_client==1.3.0
|
| 25 |
+
gunicorn==23.0.0
|
| 26 |
+
h11==0.14.0
|
| 27 |
+
httpcore==1.0.5
|
| 28 |
+
httpx==0.27.2
|
| 29 |
+
huggingface-hub==0.25.0
|
| 30 |
+
idna==3.8
|
| 31 |
+
inflection==0.5.1
|
| 32 |
+
isodate==0.7.2
|
| 33 |
+
Jinja2==3.1.4
|
| 34 |
+
joblib==1.4.2
|
| 35 |
+
jsonschema==4.23.0
|
| 36 |
+
jsonschema-specifications==2024.10.1
|
| 37 |
+
language-tags==1.2.0
|
| 38 |
+
lazy_loader==0.4
|
| 39 |
+
librosa==0.10.2.post1
|
| 40 |
+
llvmlite==0.43.0
|
| 41 |
+
lxml==5.3.0
|
| 42 |
+
Markdown==3.7
|
| 43 |
+
MarkupSafe==3.0.2
|
| 44 |
+
mpmath==1.3.0
|
| 45 |
+
msgpack==1.1.0
|
| 46 |
+
networkx==3.4.2
|
| 47 |
+
numba==0.60.0
|
| 48 |
+
numpy~=2.0.2
|
| 49 |
+
packaging==24.1
|
| 50 |
+
phonemizer==3.2.1
|
| 51 |
+
platformdirs==4.3.6
|
| 52 |
+
pooch==1.8.2
|
| 53 |
+
pycparser==2.22
|
| 54 |
+
pylatexenc==2.10
|
| 55 |
+
pyloudnorm==0.1.1
|
| 56 |
+
pyparsing==3.2.0
|
| 57 |
+
python-dateutil==2.9.0.post0
|
| 58 |
+
python-dotenv==1.0.1
|
| 59 |
+
pytz==2024.2
|
| 60 |
+
PyYAML==6.0.2
|
| 61 |
+
rdflib==7.1.1
|
| 62 |
+
referencing==0.35.1
|
| 63 |
+
regex==2024.11.6
|
| 64 |
+
requests==2.32.3
|
| 65 |
+
resampy==0.4.3
|
| 66 |
+
# Resemblyzer==0.1.4
|
| 67 |
+
rfc3986==1.5.0
|
| 68 |
+
rpds-py==0.21.0
|
| 69 |
+
scikit-learn==1.5.2
|
| 70 |
+
scipy==1.14.1
|
| 71 |
+
segments==2.2.1
|
| 72 |
+
six==1.16.0
|
| 73 |
+
sniffio==1.3.1
|
| 74 |
+
soundfile==0.12.1
|
| 75 |
+
soxr==0.5.0.post1
|
| 76 |
+
sqlparse==0.5.1
|
| 77 |
+
sympy==1.13.1
|
| 78 |
+
tabulate==0.9.0
|
| 79 |
+
threadpoolctl==3.5.0
|
| 80 |
+
tqdm~=4.67.1
|
| 81 |
+
typing==3.7.4.3
|
| 82 |
+
typing_extensions==4.12.2
|
| 83 |
+
tzdata==2024.1
|
| 84 |
+
Unidecode==1.3.6
|
| 85 |
+
uritemplate==4.1.1
|
| 86 |
+
urllib3==2.2.2
|
| 87 |
+
webrtcvad==2.0.10
|
| 88 |
+
websockets==12.0
|
| 89 |
+
whitenoise
|
| 90 |
+
protobuf~=5.29.3
|
| 91 |
+
google-auth-httplib2~=0.2.0
|
| 92 |
+
google-auth-oauthlib~=1.2.1
|
| 93 |
+
google-api-python-client~=2.160.0
|
rose_tts_api/__init__.py
ADDED
|
File without changes
|
rose_tts_api/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (174 Bytes). View file
|
|
|
rose_tts_api/__pycache__/handlers.cpython-311.pyc
ADDED
|
Binary file (4.14 kB). View file
|
|
|
rose_tts_api/__pycache__/middlewares.cpython-311.pyc
ADDED
|
Binary file (1.96 kB). View file
|
|
|
rose_tts_api/__pycache__/settings.cpython-311.pyc
ADDED
|
Binary file (4.83 kB). View file
|
|
|
rose_tts_api/__pycache__/urls.cpython-311.pyc
ADDED
|
Binary file (2.4 kB). View file
|
|
|
rose_tts_api/__pycache__/wsgi.cpython-311.pyc
ADDED
|
Binary file (706 Bytes). View file
|
|
|
rose_tts_api/asgi.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
ASGI config for rose_tts_api project.
|
| 3 |
+
|
| 4 |
+
It exposes the ASGI callable as a module-level variable named ``application``.
|
| 5 |
+
|
| 6 |
+
For more information on this file, see
|
| 7 |
+
https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
import os
|
| 11 |
+
|
| 12 |
+
from django.core.asgi import get_asgi_application
|
| 13 |
+
|
| 14 |
+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'rose_tts_api.settings')
|
| 15 |
+
|
| 16 |
+
application = get_asgi_application()
|
rose_tts_api/auth.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"type": "service_account",
|
| 3 |
+
"project_id": "erudite-nation-443217-d7",
|
| 4 |
+
"private_key_id": "f71ebcdd3a81848bf3a65352adcbc27e48bbe549",
|
| 5 |
+
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDgbEnXWTKf9H9L\nn5/C/x11G8XGrxyAASW8saAvi5jxHGEaW4LAU3IqBQgEzTRZmyAZzpPKn0CaWo7c\ndLGgSpAz3MpHmG+GJIKNGCITYE1GCZDgwVd5Jl3+nVlwx57LGcxn/fsDmsCQjZqa\nHmQ88oPqu0B0JWo6ydl647Vxl1Gh6YW8qLIKrznwsc/gT8hJ7wBAYItuCNUIPf6l\nYBRKm1r46ZFsku9nEpTOdCSrsyIOOE/c1+OKOj0bQa05OByAV/2v8EHQEfAej0Dq\n17vEsAgehEcxQAAtlts2qGnH7ZQNU6CVIYTLzEM1M3ZYTXSi//bhUi6KbeTfK8RQ\nP4H3ALHbAgMBAAECggEAAkMqiLs4zBgA4y2cGgZ3BjkzczSiCur4CxZB+84NH/vI\nltAZWgBSrvhsrkULTrlGR5GnjRax5gcdAufs6nrAnWU6Z3eymB2XcKivn0EMm7TO\nUGsNNgbG/SFvnLgbx7GzjSYoTk7/EKCnev+XbxiFb+usqKm/5REn2hn1jaGYNxOe\nFQNURgjkEZ/1OMVLFDKBYW9xar84EqSgjHytPOcrQS15ZbXKellNIwPA7IweV7XE\nQ2z6IVK4tNzNoATtu62yDPb6/5ikk4vJfGOSL6zFIYQWwOAsqZcZpL9TAjtJyNrc\nDVzyGalCKpenCLG6bmf8XIirPVTW2AbaobaxjzLRQQKBgQDw2ZlBZHilQfET22sb\nVd0xPstXUZV3GSjH4a7HV2BWDleeRW5n5C0k+JIMAl0k9iVQ4spM/JJ3ZCQgWnWh\nXjD1Cax43mQjkbVsrZbsoTIljptz4BhdOp1lQfv5nlW7i1D5nausGzuFEzAr2qDa\n2Loj+zmyxduIvFr1kpHVRnh60QKBgQDuiiqVD6zafSTlEZwlA3jJFnJB/LBFtG4h\n7M7bMRIkjlL0PnK6mwGJB2UXQNO01FnJjuJckn3phntkQLVnAdMu4lAy5GKPQQVY\nLNPU2wxtK/tSCgOmZgVh3ZDkUo0/hib7nGbQMCsHjhAX+7MjrvytwcoKXPPwVlbh\noxL2GH206wKBgQDN+GjVwYRjX2c5ohWQxPdqm9btj7mQppV3iosbsp+SOKW5lor6\nkeoBignr90GM0GvNJoX3HLBtJdi3SmT6YUDg7SrwGs/skzlh/XnqV1g5QiGzENwF\nLpFX/Pvt1vhecKAJOEuN3aQjA+vYNRoGzf0xtDD9r7M01k+7X2MTzzZNYQKBgQDc\ntkzmNWXLl+Vualfey5KUBUfdFJCJPoR0sWdI2uOdnW7V/X4seUX3Yzc/R8VbWOxn\nGeUKoKUOUVeUkGcIk2CyzcZFAJrNT+1BA+FQ3wllbj+RTiDIczdhsR/ikxuMfnVN\ndA6RbTAzQlhTyJmdV8kGgPuPkShI5apoBnqB6HFP1wKBgQDe4URcskO7BvYMqLfd\nn04VKOFbw+yZVHg2H10gjEdRt5n4lu7vSOKcADHP2Z0y+6OcY9wLjiA78UetA0Ln\nJ3OjWET5zsEiDRVtI4akTCtWYedJh7oypMqE2+Fm/6J8fe7ZK4fGq+CQ1k32S7qQ\nhS6r9cSf16ENeMicOYhWu5tNCQ==\n-----END PRIVATE KEY-----\n",
|
| 6 |
+
"client_email": "log-sender@erudite-nation-443217-d7.iam.gserviceaccount.com",
|
| 7 |
+
"client_id": "100643352893497577051",
|
| 8 |
+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
| 9 |
+
"token_uri": "https://oauth2.googleapis.com/token",
|
| 10 |
+
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
| 11 |
+
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/log-sender%40erudite-nation-443217-d7.iam.gserviceaccount.com",
|
| 12 |
+
"universe_domain": "googleapis.com"
|
| 13 |
+
}
|
rose_tts_api/handlers.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import logging
|
| 3 |
+
import traceback
|
| 4 |
+
|
| 5 |
+
from google.oauth2.credentials import Credentials
|
| 6 |
+
import logging
|
| 7 |
+
from google.oauth2.service_account import Credentials
|
| 8 |
+
from googleapiclient.discovery import build
|
| 9 |
+
from googleapiclient.http import MediaFileUpload
|
| 10 |
+
from datetime import datetime
|
| 11 |
+
|
| 12 |
+
# Caminho para o arquivo JSON da conta de serviço
|
| 13 |
+
SERVICE_ACCOUNT_FILE = "rose_tts_api/auth.json"
|
| 14 |
+
|
| 15 |
+
# Escopo necessário para acessar o Google Drive
|
| 16 |
+
SCOPES = ["https://www.googleapis.com/auth/drive.file"]
|
| 17 |
+
|
| 18 |
+
# ID da pasta onde os logs serão armazenados (substitua pelo ID da sua pasta)
|
| 19 |
+
FOLDER_ID = "1YkqPNdzAhSzDVVLIRhx1r0-BvFfGQKjY"
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def authenticate_drive():
|
| 23 |
+
creds = Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES)
|
| 24 |
+
return build("drive", "v3", credentials=creds)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def upload_log_to_drive(log_file_path):
|
| 28 |
+
try:
|
| 29 |
+
service = authenticate_drive()
|
| 30 |
+
log_filename = f"errors_{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}.log"
|
| 31 |
+
|
| 32 |
+
media = MediaFileUpload(log_file_path, mimetype="text/plain")
|
| 33 |
+
file_metadata = {
|
| 34 |
+
"name": log_filename,
|
| 35 |
+
"mimeType": "text/plain",
|
| 36 |
+
"parents": [FOLDER_ID] # Define a pasta no Drive
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
file = service.files().create(body=file_metadata, media_body=media, fields="id").execute()
|
| 40 |
+
print(f"✅ Arquivo enviado para o Google Drive!")
|
| 41 |
+
except Exception as e:
|
| 42 |
+
print(f"❌ Erro ao enviar o arquivo: {e}")
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
# Configuração de logging com Google Drive Handler
|
| 47 |
+
class ErrorHandler(logging.Handler):
|
| 48 |
+
def __init__(self):
|
| 49 |
+
super().__init__()
|
| 50 |
+
|
| 51 |
+
def emit(self, record):
|
| 52 |
+
try:
|
| 53 |
+
log_message = self.format(record)
|
| 54 |
+
log_filename = f"errors_{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}.log"
|
| 55 |
+
log_file_path = f"/tmp/{log_filename}"
|
| 56 |
+
|
| 57 |
+
with open(log_file_path, 'w') as log_file:
|
| 58 |
+
log_file.write(log_message)
|
| 59 |
+
|
| 60 |
+
# Incluir informações detalhadas do erro, se houver
|
| 61 |
+
if record.exc_info:
|
| 62 |
+
log_file.write("\nDetalhes do erro:\n")
|
| 63 |
+
# Formatar a exceção corretamente
|
| 64 |
+
log_file.write("".join(traceback.format_exception(*record.exc_info)))
|
| 65 |
+
|
| 66 |
+
# Enviar o log para o Google Drive
|
| 67 |
+
upload_log_to_drive(log_file_path)
|
| 68 |
+
except Exception as e:
|
| 69 |
+
print(f"❌ Erro ao enviar o log: {e}")
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
|
rose_tts_api/middlewares.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import logging
|
| 2 |
+
import time
|
| 3 |
+
logger = logging.getLogger(__name__)
|
| 4 |
+
|
| 5 |
+
class APILoggingMiddleware:
|
| 6 |
+
def __init__(self, get_response):
|
| 7 |
+
self.get_response = get_response
|
| 8 |
+
|
| 9 |
+
def __call__(self, request):
|
| 10 |
+
logger.info(f"Request: {request.method} {request.path} - IP: {request.META.get('REMOTE_ADDR')}")
|
| 11 |
+
# Read request body safely
|
| 12 |
+
request_body = None
|
| 13 |
+
if request.content_type and "application/json" in request.content_type:
|
| 14 |
+
try:
|
| 15 |
+
request_body = request.body.decode("utf-8")
|
| 16 |
+
except Exception:
|
| 17 |
+
request_body = "[Could not decode request body]"
|
| 18 |
+
|
| 19 |
+
start_time = time.time()
|
| 20 |
+
response = self.get_response(request)
|
| 21 |
+
end_time = time.time()
|
| 22 |
+
execution_time = end_time - start_time
|
| 23 |
+
logger.info(f"Response: {response.status_code}, Time: {execution_time:.3f}s\n"
|
| 24 |
+
f"Body: {request_body}")
|
| 25 |
+
return response
|
rose_tts_api/settings.py
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Django settings for rose_tts_api project.
|
| 3 |
+
|
| 4 |
+
Generated by 'django-admin startproject' using Django 5.1.3.
|
| 5 |
+
|
| 6 |
+
For more information on this file, see
|
| 7 |
+
https://docs.djangoproject.com/en/5.1/topics/settings/
|
| 8 |
+
|
| 9 |
+
For the full list of settings and their values, see
|
| 10 |
+
https://docs.djangoproject.com/en/5.1/ref/settings/
|
| 11 |
+
"""
|
| 12 |
+
import logging
|
| 13 |
+
import os
|
| 14 |
+
import sys
|
| 15 |
+
from pathlib import Path
|
| 16 |
+
|
| 17 |
+
from rose_tts_hodc import TtsModelWrapper
|
| 18 |
+
|
| 19 |
+
# API SETTINGS
|
| 20 |
+
# DJANGO SETTINGS:
|
| 21 |
+
|
| 22 |
+
DEBUG = (os.getenv('DEBUG', 'False') == 'True')
|
| 23 |
+
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '*').split(',')
|
| 24 |
+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
| 25 |
+
BASE_DIR = Path(__file__).resolve().parent.parent
|
| 26 |
+
|
| 27 |
+
# Quick-start development settings - unsuitable for production
|
| 28 |
+
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
# SECURITY WARNING: keep the secret key used in production secret!
|
| 32 |
+
SECRET_KEY = 'django-insecure-27m#zp^v#^hz^q5p05r(!cp7dlhl@r(3ob9qwj2j5c$b#n&yt('
|
| 33 |
+
|
| 34 |
+
# SECURITY WARNING: don't run with debug turned on in production!
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# Application definition
|
| 38 |
+
|
| 39 |
+
INSTALLED_APPS = [
|
| 40 |
+
'django.contrib.admin',
|
| 41 |
+
'django.contrib.auth',
|
| 42 |
+
'django.contrib.contenttypes',
|
| 43 |
+
'django.contrib.sessions',
|
| 44 |
+
'django.contrib.messages',
|
| 45 |
+
'django.contrib.staticfiles',
|
| 46 |
+
|
| 47 |
+
# external modules
|
| 48 |
+
'rest_framework',
|
| 49 |
+
'rest_framework.authtoken',
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
# internal
|
| 53 |
+
'tts.apps.TtsConfig'
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
+
INSTALLED_APPS += [
|
| 57 |
+
'drf_yasg',
|
| 58 |
+
]
|
| 59 |
+
|
| 60 |
+
REST_FRAMEWORK = {
|
| 61 |
+
'DEFAULT_AUTHENTICATION_CLASSES': [
|
| 62 |
+
'rest_framework.authentication.TokenAuthentication', # Add this line
|
| 63 |
+
],
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
MIDDLEWARE = [
|
| 69 |
+
'django.middleware.security.SecurityMiddleware',
|
| 70 |
+
'django.contrib.sessions.middleware.SessionMiddleware',
|
| 71 |
+
'django.middleware.common.CommonMiddleware',
|
| 72 |
+
'django.middleware.csrf.CsrfViewMiddleware',
|
| 73 |
+
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
| 74 |
+
'django.contrib.messages.middleware.MessageMiddleware',
|
| 75 |
+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
| 76 |
+
'rose_tts_api.middlewares.APILoggingMiddleware',
|
| 77 |
+
]
|
| 78 |
+
if DEBUG:
|
| 79 |
+
MIDDLEWARE.append('whitenoise.middleware.WhiteNoiseMiddleware')
|
| 80 |
+
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
| 81 |
+
|
| 82 |
+
ROOT_URLCONF = 'rose_tts_api.urls'
|
| 83 |
+
|
| 84 |
+
TEMPLATES = [
|
| 85 |
+
{
|
| 86 |
+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
| 87 |
+
'DIRS': [BASE_DIR / 'templates']
|
| 88 |
+
,
|
| 89 |
+
'APP_DIRS': True,
|
| 90 |
+
'OPTIONS': {
|
| 91 |
+
'context_processors': [
|
| 92 |
+
'django.template.context_processors.debug',
|
| 93 |
+
'django.template.context_processors.request',
|
| 94 |
+
'django.contrib.auth.context_processors.auth',
|
| 95 |
+
'django.contrib.messages.context_processors.messages',
|
| 96 |
+
],
|
| 97 |
+
},
|
| 98 |
+
},
|
| 99 |
+
]
|
| 100 |
+
|
| 101 |
+
WSGI_APPLICATION = 'rose_tts_api.wsgi.application'
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
# Database
|
| 105 |
+
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
|
| 106 |
+
|
| 107 |
+
DATABASES = {
|
| 108 |
+
'default': {
|
| 109 |
+
'ENGINE': 'django.db.backends.sqlite3',
|
| 110 |
+
'NAME': BASE_DIR / 'db.sqlite3',
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
# Password validation
|
| 116 |
+
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
|
| 117 |
+
|
| 118 |
+
AUTH_PASSWORD_VALIDATORS = [
|
| 119 |
+
{
|
| 120 |
+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
| 121 |
+
},
|
| 122 |
+
{
|
| 123 |
+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
| 124 |
+
},
|
| 125 |
+
{
|
| 126 |
+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
| 127 |
+
},
|
| 128 |
+
{
|
| 129 |
+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
| 130 |
+
},
|
| 131 |
+
]
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
# Internationalization
|
| 135 |
+
# https://docs.djangoproject.com/en/5.1/topics/i18n/
|
| 136 |
+
|
| 137 |
+
LANGUAGE_CODE = 'pt-br'
|
| 138 |
+
|
| 139 |
+
TIME_ZONE = 'America/Sao_Paulo'
|
| 140 |
+
|
| 141 |
+
USE_I18N = True
|
| 142 |
+
|
| 143 |
+
USE_TZ = True
|
| 144 |
+
|
| 145 |
+
# Static files (CSS, JavaScript, Images)
|
| 146 |
+
# https://docs.djangoproject.com/en/5.1/howto/static-files/
|
| 147 |
+
|
| 148 |
+
STATIC_URL = 'static/'
|
| 149 |
+
|
| 150 |
+
# Default primary key field type
|
| 151 |
+
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
|
| 152 |
+
|
| 153 |
+
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
# ALL LOG CONFIGS
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
logging.getLogger('numba').setLevel(logging.WARNING)
|
| 160 |
+
logging.getLogger('google').setLevel(logging.WARNING)
|
| 161 |
+
logging.getLogger('googleapiclient').setLevel(logging.WARNING)
|
| 162 |
+
logging.getLogger('google_auth_httplib2').setLevel(logging.WARNING)
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
LOGGING = {
|
| 166 |
+
'version': 1,
|
| 167 |
+
'disable_existing_loggers': False,
|
| 168 |
+
'formatters': {
|
| 169 |
+
'verbose': {
|
| 170 |
+
'format': '{levelname} {asctime} {message}',
|
| 171 |
+
'style': '{',
|
| 172 |
+
},
|
| 173 |
+
'simple': {
|
| 174 |
+
'format': '{levelname} {message}',
|
| 175 |
+
'style': '{',
|
| 176 |
+
},
|
| 177 |
+
},
|
| 178 |
+
|
| 179 |
+
'handlers': {
|
| 180 |
+
'console': {
|
| 181 |
+
'level': 'DEBUG',
|
| 182 |
+
'class': 'logging.StreamHandler',
|
| 183 |
+
'formatter': 'simple',
|
| 184 |
+
},
|
| 185 |
+
'file_requests': {
|
| 186 |
+
'level': 'INFO',
|
| 187 |
+
'class': 'logging.FileHandler',
|
| 188 |
+
'filename': 'requests.log',
|
| 189 |
+
'formatter': 'verbose',
|
| 190 |
+
},
|
| 191 |
+
# 'file_errors': {
|
| 192 |
+
# 'level': 'ERROR',
|
| 193 |
+
# 'class': 'logging.FileHandler',
|
| 194 |
+
# 'filename': 'error.log',
|
| 195 |
+
# 'formatter': 'verbose',
|
| 196 |
+
# },
|
| 197 |
+
'file_system': {
|
| 198 |
+
'level': 'ERROR',
|
| 199 |
+
'class': 'rose_tts_api.handlers.ErrorHandler',
|
| 200 |
+
'formatter': 'verbose',
|
| 201 |
+
},
|
| 202 |
+
},
|
| 203 |
+
'loggers': {
|
| 204 |
+
'django': {
|
| 205 |
+
'handlers': ['file_requests', 'file_system'],
|
| 206 |
+
'level': 'ERROR',
|
| 207 |
+
'propagate': True,
|
| 208 |
+
},
|
| 209 |
+
'django.server': {
|
| 210 |
+
'handlers': ['file_requests'],
|
| 211 |
+
'level': 'ERROR',
|
| 212 |
+
'propagate': False,
|
| 213 |
+
},
|
| 214 |
+
'rose_tts_api': {
|
| 215 |
+
'handlers': ['file_requests' ],
|
| 216 |
+
'level': 'ERROR',
|
| 217 |
+
'propagate': False,
|
| 218 |
+
},
|
| 219 |
+
},
|
| 220 |
+
}
|
rose_tts_api/urls.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
URL configuration for rose_tts_api project.
|
| 3 |
+
|
| 4 |
+
The `urlpatterns` list routes URLs to views. For more information please see:
|
| 5 |
+
https://docs.djangoproject.com/en/5.1/topics/http/urls/
|
| 6 |
+
Examples:
|
| 7 |
+
Function views
|
| 8 |
+
1. Add an import: from my_app import views
|
| 9 |
+
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
| 10 |
+
Class-based views
|
| 11 |
+
1. Add an import: from other_app.views import Home
|
| 12 |
+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
| 13 |
+
Including another URLconf
|
| 14 |
+
1. Import the include() function: from django.urls import include, path
|
| 15 |
+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
| 16 |
+
"""
|
| 17 |
+
from django.contrib import admin
|
| 18 |
+
from django.template.context_processors import static
|
| 19 |
+
from django.urls import path, include
|
| 20 |
+
|
| 21 |
+
from rose_tts_api import settings
|
| 22 |
+
from rose_tts_api.settings import DEBUG
|
| 23 |
+
|
| 24 |
+
urlpatterns = [
|
| 25 |
+
path('admin/', admin.site.urls),
|
| 26 |
+
path('api/predict/', include('tts.urls')),
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
# if settings.DEBUG:
|
| 30 |
+
# urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
| 31 |
+
|
| 32 |
+
from drf_yasg.views import get_schema_view
|
| 33 |
+
from drf_yasg import openapi
|
| 34 |
+
from rest_framework.permissions import AllowAny
|
| 35 |
+
|
| 36 |
+
if DEBUG:
|
| 37 |
+
schema_view = get_schema_view(
|
| 38 |
+
openapi.Info(
|
| 39 |
+
title="Rose-Text-to-Speech API",
|
| 40 |
+
default_version='v1',
|
| 41 |
+
description="API para conversão de texto para fala usando os modelos rose_perguntas e multispeaker.",
|
| 42 |
+
terms_of_service="https://www.google.com/policies/terms/",
|
| 43 |
+
contact=openapi.Contact(email="fathos82@gmail.com"),
|
| 44 |
+
license=openapi.License(name="MIT License"),
|
| 45 |
+
|
| 46 |
+
),
|
| 47 |
+
public=True,
|
| 48 |
+
permission_classes=(AllowAny,),
|
| 49 |
+
)
|
| 50 |
+
urlpatterns += [
|
| 51 |
+
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
|
| 52 |
+
]
|
rose_tts_api/wsgi.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
WSGI config for rose_tts_api project.
|
| 3 |
+
|
| 4 |
+
It exposes the WSGI callable as a module-level variable named ``application``.
|
| 5 |
+
|
| 6 |
+
For more information on this file, see
|
| 7 |
+
https://docs.djangoproject.com/en/5.1/howto/deployment/wsgi/
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
import os
|
| 11 |
+
|
| 12 |
+
from django.core.wsgi import get_wsgi_application
|
| 13 |
+
|
| 14 |
+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'rose_tts_api.settings')
|
| 15 |
+
|
| 16 |
+
application = get_wsgi_application()
|
rose_tts_hodc.py
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Show Running in Cpu or Gpu and different perform
|
| 2 |
+
#Next show the Test result, Maybe run the model in different process
|
| 3 |
+
# to know the run env to perform adjust and subdivide process(cpu or gpu)
|
| 4 |
+
import subprocess
|
| 5 |
+
import time
|
| 6 |
+
import glob
|
| 7 |
+
import sys
|
| 8 |
+
from io import BytesIO
|
| 9 |
+
|
| 10 |
+
sys.path.append('vits2/')
|
| 11 |
+
import json
|
| 12 |
+
import torch
|
| 13 |
+
import numpy as np
|
| 14 |
+
|
| 15 |
+
import librosa
|
| 16 |
+
from glob import glob
|
| 17 |
+
|
| 18 |
+
from pathlib import Path
|
| 19 |
+
|
| 20 |
+
from preprocess import get_text, text_to_IPA
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
from vits2.models import SynthesizerTrn
|
| 24 |
+
from vits2.text import symbols
|
| 25 |
+
import vits2.utils as utils
|
| 26 |
+
|
| 27 |
+
# Installing 'resemblyzer' without dependencies using '--no-deps' to prevent it from overwriting
|
| 28 |
+
# the currently installed version of PyTorch (pytorch + cpu). Other dependencies such as librosa, numpy, scipy,
|
| 29 |
+
# typing, and webrtcvad are being installed normally in the 'requirements.txt' file.
|
| 30 |
+
try:
|
| 31 |
+
__import__('resemblyzer')
|
| 32 |
+
except ImportError:
|
| 33 |
+
subprocess.run("python -m pip install --no-deps Resemblyzer==0.1.4", shell=True, check=True)
|
| 34 |
+
|
| 35 |
+
from resemblyzer import VoiceEncoder, preprocess_wav
|
| 36 |
+
encoder = VoiceEncoder()
|
| 37 |
+
|
| 38 |
+
#backend = EspeakBackend('pt-br', preserve_punctuation=True, with_stress=True)
|
| 39 |
+
|
| 40 |
+
sample_rate = 22050
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
#
|
| 44 |
+
# def get_embedding_from_reference_folder(folder):
|
| 45 |
+
# embeds = []
|
| 46 |
+
# for audiopath in glob(folder + "/*.wav")[:50]:
|
| 47 |
+
# fpath = Path(audiopath)
|
| 48 |
+
# wav = preprocess_wav(fpath)
|
| 49 |
+
# embeds.append(encoder.embed_utterance(wav))
|
| 50 |
+
# if len(embeds) > 1:
|
| 51 |
+
# custom_embedding = torch.tensor(np.median(embeds, axis=0)).unsqueeze(0)
|
| 52 |
+
# else:
|
| 53 |
+
# custom_embedding = torch.tensor(embeds[0]).unsqueeze(0)
|
| 54 |
+
# return custom_embedding
|
| 55 |
+
|
| 56 |
+
def get_audio_embedding(audio):
|
| 57 |
+
wav = preprocess_wav(audio)
|
| 58 |
+
return torch.tensor(encoder.embed_utterance(wav)).unsqueeze(0)
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def convert_str_to_list_of_ints(s):
|
| 62 |
+
return [int(i) for i in s.split(",") if i.strip()]
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
hps = utils.get_hparams_from_file('./ms_pt_br_vits2.json')
|
| 66 |
+
with open('./ms_pt_br_vits2.json', "r") as f:
|
| 67 |
+
data = f.read()
|
| 68 |
+
training_hparams_json = json.loads(data)
|
| 69 |
+
with open("models_ms/embeddings.json", "r") as f:
|
| 70 |
+
embedding_paths = json.load(f)
|
| 71 |
+
|
| 72 |
+
current_model = "models_ms/multispeaker.pth"
|
| 73 |
+
|
| 74 |
+
if (
|
| 75 |
+
"use_mel_posterior_encoder" in hps.model.keys()
|
| 76 |
+
and hps.model.use_mel_posterior_encoder == True
|
| 77 |
+
):
|
| 78 |
+
print("Using mel posterior encoder for VITS2")
|
| 79 |
+
posterior_channels = 80 # vits2
|
| 80 |
+
hps.data.use_mel_posterior_encoder = True
|
| 81 |
+
else:
|
| 82 |
+
print("Using lin posterior encoder for VITS1")
|
| 83 |
+
posterior_channels = hps.data.filter_length // 2 + 1
|
| 84 |
+
hps.data.use_mel_posterior_encoder = False
|
| 85 |
+
|
| 86 |
+
if embedding_paths.get(current_model):
|
| 87 |
+
pretrained_embeddings_path = embedding_paths[current_model]
|
| 88 |
+
print(pretrained_embeddings_path)
|
| 89 |
+
else:
|
| 90 |
+
pretrained_embeddings_path = 'vits2/speaker_embeddings.pt'
|
| 91 |
+
# TODO: Edited/Commented By @fathos82, unnecessary code:
|
| 92 |
+
# net_g = SynthesizerTrn(
|
| 93 |
+
# len(symbols),
|
| 94 |
+
# posterior_channels,
|
| 95 |
+
# hps.train.segment_size // hps.data.hop_length,
|
| 96 |
+
# n_speakers=hps.data.n_speakers,
|
| 97 |
+
# pretrained_spk_emb_path=pretrained_embeddings_path,
|
| 98 |
+
# **hps.model
|
| 99 |
+
# )
|
| 100 |
+
# _ = net_g.eval()
|
| 101 |
+
#
|
| 102 |
+
# _ = utils.load_checkpoint("models_ms/multispeaker.pth", net_g, None)
|
| 103 |
+
|
| 104 |
+
def preprocess_gradio_audio(gr_audio, target_sr=48000):
|
| 105 |
+
audio, sr = gr_audio
|
| 106 |
+
|
| 107 |
+
if audio.dtype != np.float32:
|
| 108 |
+
audio = audio.astype(np.float32)
|
| 109 |
+
if audio.ndim == 2:
|
| 110 |
+
audio = np.mean(audio, axis=1)
|
| 111 |
+
if sr != target_sr:
|
| 112 |
+
audio = librosa.resample(audio, orig_sr=sr, target_sr=target_sr)
|
| 113 |
+
return (target_sr, audio)
|
| 114 |
+
|
| 115 |
+
#
|
| 116 |
+
# def process_TTS(text, selected_model, reference_audio, noise_scale=0.2, noise_scale_w=0.4, lenght_scale=1, spk_ids='3'):
|
| 117 |
+
# # TODO: Show this point
|
| 118 |
+
# global current_model, net_g
|
| 119 |
+
# if selected_model != current_model:
|
| 120 |
+
# if embedding_paths.get(selected_model):
|
| 121 |
+
# pretrained_embeddings_path = embedding_paths[selected_model]
|
| 122 |
+
# print(pretrained_embeddings_path)
|
| 123 |
+
# else:
|
| 124 |
+
# pretrained_embeddings_path = 'vits2/speaker_embeddings.pt'
|
| 125 |
+
# net_g = SynthesizerTrn(
|
| 126 |
+
# len(symbols),
|
| 127 |
+
# posterior_channels,
|
| 128 |
+
# hps.train.segment_size // hps.data.hop_length,
|
| 129 |
+
# n_speakers=hps.data.n_speakers,
|
| 130 |
+
# pretrained_spk_emb_path=pretrained_embeddings_path,
|
| 131 |
+
# **hps.model
|
| 132 |
+
# )
|
| 133 |
+
# _ = net_g.eval()
|
| 134 |
+
# _ = utils.load_checkpoint(selected_model, net_g, None)
|
| 135 |
+
# current_model = selected_model
|
| 136 |
+
#
|
| 137 |
+
# ipa_rep = text_to_IPA(text)
|
| 138 |
+
# stn_tst = get_text(ipa_rep, hps)
|
| 139 |
+
# s_ids = convert_str_to_list_of_ints(spk_ids)
|
| 140 |
+
# custom_embedding_from_sids = torch.mean(torch.stack([net_g.emb_g(torch.LongTensor([x])) for x in s_ids]), axis=0)
|
| 141 |
+
# if reference_audio is not None:
|
| 142 |
+
# sr, guiding_audio = preprocess_gradio_audio(reference_audio, target_sr=16000)
|
| 143 |
+
# embedding = get_audio_embedding(guiding_audio)
|
| 144 |
+
# else:
|
| 145 |
+
# embedding = custom_embedding_from_sids
|
| 146 |
+
# with torch.no_grad():
|
| 147 |
+
# x_tst = stn_tst.unsqueeze(0)
|
| 148 |
+
# x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
|
| 149 |
+
# sid = torch.LongTensor([0])
|
| 150 |
+
# audio = net_g.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=noise_scale, noise_scale_w=noise_scale_w,
|
| 151 |
+
# length_scale=lenght_scale, custom_emb=embedding)[0][0, 0].data.cpu().float().numpy()
|
| 152 |
+
|
| 153 |
+
# return sample_rate, audio
|
| 154 |
+
|
| 155 |
+
# Todo: Created by @fathos82, meu objetivo é utilizar um Wrapper para instanciar os modelos para realiizar cache, sem comprometer o codigo original da IA.
|
| 156 |
+
class TtsModelWrapper:
|
| 157 |
+
"""
|
| 158 |
+
Classe Wrapper para o modelo de síntese de fala.
|
| 159 |
+
Esta classe encapsula a inicialização e o uso do modelo de síntese de voz, permitindo interagir com ele sem modificar a lógica interna original.
|
| 160 |
+
|
| 161 |
+
A ideia é encapsular toda a lógica de inicialização e execução do modelo de IA dentro desta classe,
|
| 162 |
+
fornecendo uma interface mais limpa e reutilizável para a API.
|
| 163 |
+
"""
|
| 164 |
+
|
| 165 |
+
def __init__(self, model):
|
| 166 |
+
"""
|
| 167 |
+
Inicializa o modelo de síntese de voz e carrega os parâmetros necessários.
|
| 168 |
+
|
| 169 |
+
Args:
|
| 170 |
+
model (str): Caminho para o modelo que será carregado.
|
| 171 |
+
"""
|
| 172 |
+
self.net_g: SynthesizerTrn = None
|
| 173 |
+
self.initialize_model(model)
|
| 174 |
+
|
| 175 |
+
def process_TTS(self, text, reference_audio=None, noise_scale=0.2, noise_scale_w=0.4, length_scale=1, spk_ids='3'):
|
| 176 |
+
"""
|
| 177 |
+
Gera o áudio a partir do texto usando o modelo de síntese de voz.
|
| 178 |
+
|
| 179 |
+
Args:
|
| 180 |
+
text (str): O texto a ser convertido em áudio.
|
| 181 |
+
reference_audio (AudioFile): Áudio de referência opcional para personalizar a fala.
|
| 182 |
+
noise_scale (float): Controla a quantidade de variação no áudio gerado.
|
| 183 |
+
noise_scale_w (float): Controla o nível de ruído adicionado ao áudio.
|
| 184 |
+
length_scale (float): Controla a velocidade do áudio gerado.
|
| 185 |
+
spk_ids (str): IDs dos falantes para personalização do áudio.
|
| 186 |
+
|
| 187 |
+
Returns:
|
| 188 |
+
tuple: Taxa de amostragem e o áudio gerado como um array numpy.
|
| 189 |
+
"""
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
ipa_rep = text_to_IPA(text)
|
| 193 |
+
stn_tst = get_text(ipa_rep, hps)
|
| 194 |
+
s_ids = convert_str_to_list_of_ints(spk_ids)
|
| 195 |
+
|
| 196 |
+
custom_embedding_from_sids = torch.mean(torch.stack([self.net_g.emb_g(torch.LongTensor([x])) for x in s_ids]),
|
| 197 |
+
axis=0)
|
| 198 |
+
if reference_audio is not None:
|
| 199 |
+
# Adptando gradio_audio para um audio carregado pelo librosa
|
| 200 |
+
reference_audio_librosa = librosa.load(BytesIO(reference_audio.read()))
|
| 201 |
+
sr, guiding_audio = preprocess_gradio_audio(reference_audio_librosa, target_sr=16000)
|
| 202 |
+
embedding = get_audio_embedding(guiding_audio)
|
| 203 |
+
pass
|
| 204 |
+
else:
|
| 205 |
+
embedding = custom_embedding_from_sids
|
| 206 |
+
|
| 207 |
+
with torch.no_grad():
|
| 208 |
+
x_tst = stn_tst.unsqueeze(0)
|
| 209 |
+
x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
|
| 210 |
+
sid = torch.LongTensor([0])
|
| 211 |
+
audio = \
|
| 212 |
+
self.net_g.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=noise_scale, noise_scale_w=noise_scale_w,
|
| 213 |
+
length_scale=length_scale, custom_emb=embedding)[0][0, 0].data.cpu().float().numpy()
|
| 214 |
+
|
| 215 |
+
return sample_rate, audio
|
| 216 |
+
|
| 217 |
+
def initialize_model(self, model):
|
| 218 |
+
"""
|
| 219 |
+
Inicializa o modelo de síntese de voz com os parâmetros e o modelo pré-treinado especificado.
|
| 220 |
+
|
| 221 |
+
Args:
|
| 222 |
+
model (str): Caminho para o modelo que será carregado.
|
| 223 |
+
"""
|
| 224 |
+
# Carrega o caminho do embedding pre-treinado, caso necessário
|
| 225 |
+
if embedding_paths.get(model):
|
| 226 |
+
pretrained_embeddings_path = embedding_paths[model]
|
| 227 |
+
print(pretrained_embeddings_path)
|
| 228 |
+
else:
|
| 229 |
+
pretrained_embeddings_path = 'vits2/speaker_embeddings.pt'
|
| 230 |
+
|
| 231 |
+
# Inicializa o modelo com os parâmetros carregados
|
| 232 |
+
self.net_g = SynthesizerTrn(
|
| 233 |
+
len(symbols),
|
| 234 |
+
posterior_channels,
|
| 235 |
+
hps.train.segment_size // hps.data.hop_length,
|
| 236 |
+
n_speakers=hps.data.n_speakers,
|
| 237 |
+
pretrained_spk_emb_path=pretrained_embeddings_path,
|
| 238 |
+
**hps.model
|
| 239 |
+
)
|
| 240 |
+
|
| 241 |
+
_ = self.net_g.eval()
|
| 242 |
+
print("./"+model)
|
| 243 |
+
_ = utils.load_checkpoint("./"+model, self.net_g, None)
|
tts/__init__.py
ADDED
|
File without changes
|
tts/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (165 Bytes). View file
|
|
|
tts/__pycache__/admin.cpython-311.pyc
ADDED
|
Binary file (220 Bytes). View file
|
|
|
tts/__pycache__/apps.cpython-311.pyc
ADDED
|
Binary file (1.32 kB). View file
|
|
|
tts/__pycache__/models.cpython-311.pyc
ADDED
|
Binary file (217 Bytes). View file
|
|
|
tts/__pycache__/serializers.cpython-311.pyc
ADDED
|
Binary file (2.3 kB). View file
|
|
|
tts/__pycache__/urls.cpython-311.pyc
ADDED
|
Binary file (958 Bytes). View file
|
|
|
tts/__pycache__/views.cpython-311.pyc
ADDED
|
Binary file (6.11 kB). View file
|
|
|
tts/admin.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.contrib import admin
|
| 2 |
+
|
| 3 |
+
# Register your models here.
|
tts/apps.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.apps import AppConfig
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
from rose_tts_hodc import TtsModelWrapper
|
| 5 |
+
# import intel_extension_for_pytorch as ipex
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class TtsConfig(AppConfig):
|
| 9 |
+
default_auto_field = 'django.db.models.BigAutoField'
|
| 10 |
+
name = 'tts'
|
| 11 |
+
models = {}
|
| 12 |
+
|
| 13 |
+
@classmethod
|
| 14 |
+
def load_models(cls):
|
| 15 |
+
for model_name in ['multispeaker', 'rose_perguntas']:
|
| 16 |
+
model = cls.models.get(model_name)
|
| 17 |
+
if model is None:
|
| 18 |
+
model_path = 'models_ms/' + model_name + '.pth'
|
| 19 |
+
model = TtsModelWrapper(model_path)
|
| 20 |
+
# ipex.optimize(model.net_g, inplace=True)
|
| 21 |
+
cls.models[model_name] = model
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def ready(self):
|
| 25 |
+
TtsConfig.load_models()
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
tts/migrations/__init__.py
ADDED
|
File without changes
|
tts/migrations/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (176 Bytes). View file
|
|
|
tts/models.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.db import models
|
| 2 |
+
|
| 3 |
+
# Create your models here.
|
tts/serializers.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
from rest_framework import serializers
|
| 3 |
+
|
| 4 |
+
ALLOWED_AUDIO_FILES = ["wav", "mp3"]
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def format_selected_model(input_str):
|
| 8 |
+
formatted_str = re.sub(r'^(?!models_ms/)', 'models_ms/', input_str) # Adiciona o prefixo se estiver ausente
|
| 9 |
+
formatted_str = re.sub(r'(?<!\.pth)$', '.pth', formatted_str) # Adiciona o sufixo se estiver ausente
|
| 10 |
+
return formatted_str
|
| 11 |
+
def validate_spk_ids(value):
|
| 12 |
+
if not value.isdigit() or not (0 <= int(value) < 43):
|
| 13 |
+
raise serializers.ValidationError("O valor de spk_ids deve ser um número entre 0 e 42.")
|
| 14 |
+
def validate_audio_file(file):
|
| 15 |
+
file_type = file.name.split(".")[-1]
|
| 16 |
+
if file_type not in ALLOWED_AUDIO_FILES:
|
| 17 |
+
raise serializers.ValidationError("Apenas audios do tipo wav ou mp3 são permitidos para este campo.")
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class TtsSerializer(serializers.Serializer):
|
| 21 |
+
text = serializers.CharField()
|
| 22 |
+
reference_audio = serializers.FileField(default=None,validators=[validate_audio_file])
|
| 23 |
+
noise_scale = serializers.FloatField(default=0.2)
|
| 24 |
+
noise_scale_w = serializers.FloatField(default=0.2)
|
| 25 |
+
length_scale = serializers.FloatField(default=1.0)
|
| 26 |
+
# Verficar esse limite de 43 caso haja alguma atualização que adicione novas vozes!
|
| 27 |
+
spk_ids = serializers.CharField(default='3', validators= [validate_spk_ids])
|
| 28 |
+
|
tts/tests.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.test import TestCase
|
| 2 |
+
|
| 3 |
+
# Create your tests here.
|
tts/urls.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
from django.contrib import admin
|
| 3 |
+
from django.urls import path, include
|
| 4 |
+
|
| 5 |
+
from rose_tts_api.settings import DEBUG
|
| 6 |
+
from tts.views import TtsRosePerguntasView, TtsMultiSpeakerView, TestError
|
| 7 |
+
|
| 8 |
+
# from tts.views import TtsView
|
| 9 |
+
|
| 10 |
+
# End-points:
|
| 11 |
+
# - /api/predict/multispeaker
|
| 12 |
+
# - /api/predict/rose_perguntas
|
| 13 |
+
|
| 14 |
+
urlpatterns = [
|
| 15 |
+
# path('', TtsView.as_view(), name='tts_view')
|
| 16 |
+
path('multispeaker', TtsMultiSpeakerView.as_view(), name='multispeaker'),
|
| 17 |
+
path('rose_perguntas', TtsRosePerguntasView.as_view(), name='rose-perguntas'),
|
| 18 |
+
|
| 19 |
+
]
|
| 20 |
+
|
| 21 |
+
# This endpoint forces error
|
| 22 |
+
# Used to test Log System.
|
| 23 |
+
if DEBUG:
|
| 24 |
+
urlpatterns.append( path('test-error', TestError.as_view(), name='test-error')
|
| 25 |
+
)
|