Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Clean up setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Hansen committed Mar 26, 2021
1 parent 65e39aa commit 13311e2
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ __pycache__/
/build/
/.venv/
/dist/
/local/
*.onnx
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ include requirements.txt
include requirements_dev.txt
include LICENSE
include README.md
include VERSION
include larynx/VERSION
40 changes: 36 additions & 4 deletions bin/make_sample_html.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
import sys
from collections import defaultdict
from pathlib import Path


Expand All @@ -12,9 +13,13 @@ def main():
print('<head><meta charset="utf-8"><title>Larynx Voice Samples</title></head>')
print("<body>")
print("<h1>Larynx Voice Samples</h1>")
print('<p>Voices samples trained for <a href="https://github.com/rhasspy/larynx">Larynx.</a></p>')

local_dir = Path(sys.argv[1])

# language -> voice name -> samples dir
voices = defaultdict(dict)

# local/<LANGUAGE>/<VOICE>-<MODEL>
for lang_dir in sorted(Path(local_dir).iterdir()):
if not lang_dir.is_dir():
Expand All @@ -26,8 +31,6 @@ def main():
# Exclude vocoders
continue

print("<h2>", language, "</h2>")

for voice_dir in sorted(lang_dir.iterdir()):
if not voice_dir.is_dir():
continue
Expand All @@ -42,8 +45,37 @@ def main():
print("Missing", test_sentences, file=sys.stderr)
continue

voice, model_type = voice_dir.name.split("-", maxsplit=1)
print("<h3>", voice, f"({model_type})", "</h3>")
voices[language][voice_dir.name] = samples_dir

# Print table of contents
print("<ul>")
for language, lang_voices in voices.items():
print("<li>", f'<a href="#{language}">', language, "</a>")

print("<ul>")
for voice_name in lang_voices:
print(
"<li>",
f'<a href="#{language}_{voice_name}">',
voice_name,
"</a>",
"</li>",
)
print("</ul>")

print("</li>")

print("</ul>")
print("<hr>")

# Print samples
for language, lang_voices in voices.items():
print(f'<h2 id="{language}">', language, "</h2>")

for voice_name, samples_dir in lang_voices.items():
test_sentences = samples_dir / "test_sentences.txt"
voice, model_type = voice_name.split("-", maxsplit=1)
print(f'<h3 id="{language}_{voice_name}">', voice, f"({model_type})", "</h3>")

with open(test_sentences, "r") as test_sentences_file:
for line in sorted(test_sentences_file):
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions larynx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

_LOGGER = logging.getLogger("larynx")

_DIR = Path(__file__).parent

__version__ = (_DIR / "VERSION").read_text().strip()

# -----------------------------------------------------------------------------


Expand Down
4 changes: 2 additions & 2 deletions larynx/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ def main():

def get_args():
"""Parse command-line arguments"""
parser = argparse.ArgumentParser(prog="larynx-runtime")
parser = argparse.ArgumentParser(prog="larynx")
parser.add_argument(
"--language", required=True, help="Gruut language for text input"
"--language", required=True, help="Gruut language for text input (en-us, etc.)"
)
parser.add_argument(
"text", nargs="*", help="Text to convert to speech (default: stdin)"
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import setuptools

this_dir = Path(__file__).parent
module_dir = this_dir / "larynx"

# -----------------------------------------------------------------------------

Expand All @@ -20,7 +21,7 @@
with open(requirements_path, "r") as requirements_file:
requirements = requirements_file.read().splitlines()

version_path = this_dir / "VERSION"
version_path = module_dir / "VERSION"
with open(version_path, "r") as version_file:
version = version_file.read().strip()

Expand All @@ -34,7 +35,7 @@
author_email="[email protected]",
url="https://github.com/rhasspy/larynx",
packages=setuptools.find_packages(),
package_data={"larynx": ["py.typed"]},
package_data={"larynx": ["VERSION", "py.typed"]},
install_requires=requirements,
entry_points={"console_scripts": ["larynx = larynx.__main__:main"]},
classifiers=[
Expand Down

0 comments on commit 13311e2

Please sign in to comment.