yta-fastapi-docker-tts-google 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- yta_fastapi_docker_tts_google-0.0.1/LICENSE +19 -0
- yta_fastapi_docker_tts_google-0.0.1/PKG-INFO +30 -0
- yta_fastapi_docker_tts_google-0.0.1/README.md +11 -0
- yta_fastapi_docker_tts_google-0.0.1/pyproject.toml +35 -0
- yta_fastapi_docker_tts_google-0.0.1/src/yta_fastapi_docker_tts_google/__init__.py +5 -0
- yta_fastapi_docker_tts_google-0.0.1/src/yta_fastapi_docker_tts_google/app/__init__.py +0 -0
- yta_fastapi_docker_tts_google-0.0.1/src/yta_fastapi_docker_tts_google/app/main.py +10 -0
- yta_fastapi_docker_tts_google-0.0.1/src/yta_fastapi_docker_tts_google/app/routers/__init__.py +20 -0
- yta_fastapi_docker_tts_google-0.0.1/src/yta_fastapi_docker_tts_google/app/routers/tts_google.py +55 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2018 The Python Packaging Authority
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: yta-fastapi-docker-tts-google
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Youtube Autonomous FastAPI Docker TTS Google Module
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Author: danialcala94
|
|
7
|
+
Author-email: danielalcalavalera@gmail.com
|
|
8
|
+
Requires-Python: >=3.10,<3.14
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Requires-Dist: fastapi (>=0.138.0,<9999.0.0)
|
|
15
|
+
Requires-Dist: uvicorn (>=0.48.0,<9999.0.0)
|
|
16
|
+
Requires-Dist: yta_audio_narration_google (>=0.2.1,<1.0.0)
|
|
17
|
+
Requires-Dist: yta_fastapi_docker_tts_common (>=0.0.1,<1.0.0)
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# Youtube Autonomous FastAPI Docker TTS Google Module
|
|
21
|
+
|
|
22
|
+
The module that is providing the functionality related to generating audio narrations (TTS) through a FastAPI that is included and isolated in a Docker container but exposed to the internal and general FastAPI.
|
|
23
|
+
|
|
24
|
+
### Endpoints
|
|
25
|
+
|
|
26
|
+
#### GET
|
|
27
|
+
No endpoints yet
|
|
28
|
+
|
|
29
|
+
#### POST
|
|
30
|
+
No endpoints yet
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Youtube Autonomous FastAPI Docker TTS Google Module
|
|
2
|
+
|
|
3
|
+
The module that is providing the functionality related to generating audio narrations (TTS) through a FastAPI that is included and isolated in a Docker container but exposed to the internal and general FastAPI.
|
|
4
|
+
|
|
5
|
+
### Endpoints
|
|
6
|
+
|
|
7
|
+
#### GET
|
|
8
|
+
No endpoints yet
|
|
9
|
+
|
|
10
|
+
#### POST
|
|
11
|
+
No endpoints yet
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "yta-fastapi-docker-tts-google"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
description = "Youtube Autonomous FastAPI Docker TTS Google Module"
|
|
5
|
+
authors = [
|
|
6
|
+
{name = "danialcala94", email = "danielalcalavalera@gmail.com"}
|
|
7
|
+
]
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.10,<3.14"
|
|
10
|
+
|
|
11
|
+
[tool.poetry.dependencies]
|
|
12
|
+
# Mandatory
|
|
13
|
+
yta_audio_narration_google = { version = ">=0.2.1,<1.0.0", optional = false }
|
|
14
|
+
yta_fastapi_docker_tts_common = { version = ">=0.0.1,<1.0.0", optional = false }
|
|
15
|
+
fastapi = { version = ">=0.138.0,<9999.0.0", optional = false }
|
|
16
|
+
uvicorn = { version = ">=0.48.0,<9999.0.0", optional = false }
|
|
17
|
+
# Optional
|
|
18
|
+
|
|
19
|
+
[tool.poetry]
|
|
20
|
+
packages = [{include = "yta_fastapi_docker_tts_google", from = "src"}]
|
|
21
|
+
|
|
22
|
+
[tool.poetry.group.dev.dependencies]
|
|
23
|
+
pytest = "^8.3.5"
|
|
24
|
+
httpx = ">=0.28.1"
|
|
25
|
+
yta_testing = ">=0.3.7"
|
|
26
|
+
|
|
27
|
+
[tool.pytest.ini_options]
|
|
28
|
+
markers = [
|
|
29
|
+
"mandatory: mandatory tests for release",
|
|
30
|
+
"additional: exhaustive and demanding tests"
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[build-system]
|
|
34
|
+
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
35
|
+
build-backend = "poetry.core.masonry.api"
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from yta_fastapi_docker_tts_google.app.routers import router as general_router
|
|
2
|
+
from yta_fastapi_docker_tts_google.app.routers.tts_google import router as tts_google_router
|
|
3
|
+
from fastapi import FastAPI
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
app = FastAPI()
|
|
7
|
+
|
|
8
|
+
# Include all the routers we have
|
|
9
|
+
app.include_router(general_router)
|
|
10
|
+
app.include_router(tts_google_router)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from fastapi import APIRouter
|
|
2
|
+
from fastapi.responses import JSONResponse
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
PREFIX = f''
|
|
6
|
+
|
|
7
|
+
router = APIRouter(
|
|
8
|
+
prefix = PREFIX
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
@router.get('/check-status')
|
|
12
|
+
def route_check_status(
|
|
13
|
+
) -> JSONResponse:
|
|
14
|
+
return JSONResponse(
|
|
15
|
+
{
|
|
16
|
+
'error': False,
|
|
17
|
+
'message': 'Hello World!'
|
|
18
|
+
},
|
|
19
|
+
status_code = 200
|
|
20
|
+
)
|
yta_fastapi_docker_tts_google-0.0.1/src/yta_fastapi_docker_tts_google/app/routers/tts_google.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This proxy in the middle should close the client
|
|
3
|
+
but the response.
|
|
4
|
+
"""
|
|
5
|
+
from yta_audio_narration_google import GoogleTTSEngine
|
|
6
|
+
from yta_audio_narration_common.voice import VoiceSettings
|
|
7
|
+
from yta_fastapi_docker_tts_common import validate_tts_parameters
|
|
8
|
+
from fastapi import APIRouter
|
|
9
|
+
from fastapi.responses import StreamingResponse, Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
PREFIX = f'/tts/google'
|
|
13
|
+
|
|
14
|
+
router = APIRouter(
|
|
15
|
+
prefix = PREFIX
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
@router.get('/voices')
|
|
19
|
+
async def get_tts_google_voices(
|
|
20
|
+
) -> Response:
|
|
21
|
+
return GoogleTTSEngine().get_available_options()
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@router.post('/narrate')
|
|
25
|
+
async def post_tts_google_narrate(
|
|
26
|
+
request: dict
|
|
27
|
+
):
|
|
28
|
+
if not 'text' in request:
|
|
29
|
+
raise Exception('No "text" to narrate provided.')
|
|
30
|
+
|
|
31
|
+
tts_engine = GoogleTTSEngine()
|
|
32
|
+
|
|
33
|
+
parameters = validate_tts_parameters(
|
|
34
|
+
tts_engine,
|
|
35
|
+
request.get("options", {})
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
voice = VoiceSettings(
|
|
39
|
+
language = parameters['language'],
|
|
40
|
+
voice_name = parameters['voice_name'],
|
|
41
|
+
speed = parameters['speed'],
|
|
42
|
+
emotion = parameters['emotion'],
|
|
43
|
+
pitch = parameters['pitch']
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
audio_stream = tts_engine.narrate_to_stream(
|
|
47
|
+
text = request["text"],
|
|
48
|
+
voice = voice
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
return StreamingResponse(
|
|
52
|
+
content = audio_stream,
|
|
53
|
+
status_code = 200,
|
|
54
|
+
media_type = 'audio/wav'
|
|
55
|
+
)
|