setup file added in app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -1,3 +1,145 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 1 | 
         
             
            import gradio as gr
         
     | 
| 2 | 
         
             
            import torch
         
     | 
| 3 | 
         
             
            from TTS.api import TTS
         
     | 
| 
         | 
|
| 1 | 
         
            +
            #!/usr/bin/env python
         
     | 
| 2 | 
         
            +
            #                   ,*++++++*,                ,*++++++*,
         
     | 
| 3 | 
         
            +
            #                *++.        .+++          *++.        .++*
         
     | 
| 4 | 
         
            +
            #              *+*     ,++++*   *+*      *+*   ,++++,     *+*
         
     | 
| 5 | 
         
            +
            #             ,+,   .++++++++++* ,++,,,,*+, ,++++++++++.   *+,
         
     | 
| 6 | 
         
            +
            #             *+.  .++++++++++++..++    *+.,++++++++++++.  .+*
         
     | 
| 7 | 
         
            +
            #             .+*   ++++++++++++.*+,    .+*.++++++++++++   *+,
         
     | 
| 8 | 
         
            +
            #              .++   *++++++++* ++,      .++.*++++++++*   ++,
         
     | 
| 9 | 
         
            +
            #               ,+++*.    . .*++,          ,++*.      .*+++*
         
     | 
| 10 | 
         
            +
            #              *+,   .,*++**.                  .**++**.   ,+*
         
     | 
| 11 | 
         
            +
            #             .+*                                          *+,
         
     | 
| 12 | 
         
            +
            #             *+.                   Coqui                  .+*
         
     | 
| 13 | 
         
            +
            #             *+*              +++   TTS  +++              *+*
         
     | 
| 14 | 
         
            +
            #             .+++*.            .          .             *+++.
         
     | 
| 15 | 
         
            +
            #              ,+* *+++*...                       ...*+++* *+,
         
     | 
| 16 | 
         
            +
            #               .++.    .""""+++++++****+++++++"""".     ++.
         
     | 
| 17 | 
         
            +
            #                 ,++.                                .++,
         
     | 
| 18 | 
         
            +
            #                   .++*                            *++.
         
     | 
| 19 | 
         
            +
            #                       *+++,                  ,+++*
         
     | 
| 20 | 
         
            +
            #                           .,*++++::::::++++*,.
         
     | 
| 21 | 
         
            +
            #                                  ``````
         
     | 
| 22 | 
         
            +
             
     | 
| 23 | 
         
            +
            import os
         
     | 
| 24 | 
         
            +
            import subprocess
         
     | 
| 25 | 
         
            +
            import sys
         
     | 
| 26 | 
         
            +
            from packaging.version import Version
         
     | 
| 27 | 
         
            +
             
     | 
| 28 | 
         
            +
            import numpy
         
     | 
| 29 | 
         
            +
            import setuptools.command.build_py
         
     | 
| 30 | 
         
            +
            import setuptools.command.develop
         
     | 
| 31 | 
         
            +
            from Cython.Build import cythonize
         
     | 
| 32 | 
         
            +
            from setuptools import Extension, find_packages, setup
         
     | 
| 33 | 
         
            +
             
     | 
| 34 | 
         
            +
            python_version = sys.version.split()[0]
         
     | 
| 35 | 
         
            +
            if Version(python_version) < Version("3.9") or Version(python_version) >= Version("3.12"):
         
     | 
| 36 | 
         
            +
                raise RuntimeError("TTS requires python >= 3.9 and < 3.12 " "but your Python version is {}".format(sys.version))
         
     | 
| 37 | 
         
            +
             
     | 
| 38 | 
         
            +
             
     | 
| 39 | 
         
            +
            cwd = os.path.dirname(os.path.abspath(__file__))
         
     | 
| 40 | 
         
            +
            with open(os.path.join(cwd, "TTS", "VERSION")) as fin:
         
     | 
| 41 | 
         
            +
                version = fin.read().strip()
         
     | 
| 42 | 
         
            +
             
     | 
| 43 | 
         
            +
             
     | 
| 44 | 
         
            +
            class build_py(setuptools.command.build_py.build_py):  # pylint: disable=too-many-ancestors
         
     | 
| 45 | 
         
            +
                def run(self):
         
     | 
| 46 | 
         
            +
                    setuptools.command.build_py.build_py.run(self)
         
     | 
| 47 | 
         
            +
             
     | 
| 48 | 
         
            +
             
     | 
| 49 | 
         
            +
            class develop(setuptools.command.develop.develop):
         
     | 
| 50 | 
         
            +
                def run(self):
         
     | 
| 51 | 
         
            +
                    setuptools.command.develop.develop.run(self)
         
     | 
| 52 | 
         
            +
             
     | 
| 53 | 
         
            +
             
     | 
| 54 | 
         
            +
            # The documentation for this feature is in server/README.md
         
     | 
| 55 | 
         
            +
            package_data = ["TTS/server/templates/*"]
         
     | 
| 56 | 
         
            +
             
     | 
| 57 | 
         
            +
             
     | 
| 58 | 
         
            +
            def pip_install(package_name):
         
     | 
| 59 | 
         
            +
                subprocess.call([sys.executable, "-m", "pip", "install", package_name])
         
     | 
| 60 | 
         
            +
             
     | 
| 61 | 
         
            +
             
     | 
| 62 | 
         
            +
            requirements = open(os.path.join(cwd, "requirements.txt"), "r").readlines()
         
     | 
| 63 | 
         
            +
            with open(os.path.join(cwd, "requirements.notebooks.txt"), "r") as f:
         
     | 
| 64 | 
         
            +
                requirements_notebooks = f.readlines()
         
     | 
| 65 | 
         
            +
            with open(os.path.join(cwd, "requirements.dev.txt"), "r") as f:
         
     | 
| 66 | 
         
            +
                requirements_dev = f.readlines()
         
     | 
| 67 | 
         
            +
            with open(os.path.join(cwd, "requirements.ja.txt"), "r") as f:
         
     | 
| 68 | 
         
            +
                requirements_ja = f.readlines()
         
     | 
| 69 | 
         
            +
            requirements_all = requirements_dev + requirements_notebooks + requirements_ja
         
     | 
| 70 | 
         
            +
             
     | 
| 71 | 
         
            +
            with open("README.md", "r", encoding="utf-8") as readme_file:
         
     | 
| 72 | 
         
            +
                README = readme_file.read()
         
     | 
| 73 | 
         
            +
             
     | 
| 74 | 
         
            +
            exts = [
         
     | 
| 75 | 
         
            +
                Extension(
         
     | 
| 76 | 
         
            +
                    name="TTS.tts.utils.monotonic_align.core",
         
     | 
| 77 | 
         
            +
                    sources=["TTS/tts/utils/monotonic_align/core.pyx"],
         
     | 
| 78 | 
         
            +
                )
         
     | 
| 79 | 
         
            +
            ]
         
     | 
| 80 | 
         
            +
            setup(
         
     | 
| 81 | 
         
            +
                name="TTS",
         
     | 
| 82 | 
         
            +
                version=version,
         
     | 
| 83 | 
         
            +
                url="https://github.com/coqui-ai/TTS",
         
     | 
| 84 | 
         
            +
                author="Eren Gölge",
         
     | 
| 85 | 
         
            +
                author_email="[email protected]",
         
     | 
| 86 | 
         
            +
                description="Deep learning for Text to Speech by Coqui.",
         
     | 
| 87 | 
         
            +
                long_description=README,
         
     | 
| 88 | 
         
            +
                long_description_content_type="text/markdown",
         
     | 
| 89 | 
         
            +
                license="MPL-2.0",
         
     | 
| 90 | 
         
            +
                # cython
         
     | 
| 91 | 
         
            +
                include_dirs=numpy.get_include(),
         
     | 
| 92 | 
         
            +
                ext_modules=cythonize(exts, language_level=3),
         
     | 
| 93 | 
         
            +
                # ext_modules=find_cython_extensions(),
         
     | 
| 94 | 
         
            +
                # package
         
     | 
| 95 | 
         
            +
                include_package_data=True,
         
     | 
| 96 | 
         
            +
                packages=find_packages(include=["TTS"], exclude=["*.tests", "*tests.*", "tests.*", "*tests", "tests"]),
         
     | 
| 97 | 
         
            +
                package_data={
         
     | 
| 98 | 
         
            +
                    "TTS": [
         
     | 
| 99 | 
         
            +
                        "VERSION",
         
     | 
| 100 | 
         
            +
                    ]
         
     | 
| 101 | 
         
            +
                },
         
     | 
| 102 | 
         
            +
                project_urls={
         
     | 
| 103 | 
         
            +
                    "Documentation": "https://github.com/coqui-ai/TTS/wiki",
         
     | 
| 104 | 
         
            +
                    "Tracker": "https://github.com/coqui-ai/TTS/issues",
         
     | 
| 105 | 
         
            +
                    "Repository": "https://github.com/coqui-ai/TTS",
         
     | 
| 106 | 
         
            +
                    "Discussions": "https://github.com/coqui-ai/TTS/discussions",
         
     | 
| 107 | 
         
            +
                },
         
     | 
| 108 | 
         
            +
                cmdclass={
         
     | 
| 109 | 
         
            +
                    "build_py": build_py,
         
     | 
| 110 | 
         
            +
                    "develop": develop,
         
     | 
| 111 | 
         
            +
                    # 'build_ext': build_ext
         
     | 
| 112 | 
         
            +
                },
         
     | 
| 113 | 
         
            +
                install_requires=requirements,
         
     | 
| 114 | 
         
            +
                extras_require={
         
     | 
| 115 | 
         
            +
                    "all": requirements_all,
         
     | 
| 116 | 
         
            +
                    "dev": requirements_dev,
         
     | 
| 117 | 
         
            +
                    "notebooks": requirements_notebooks,
         
     | 
| 118 | 
         
            +
                    "ja": requirements_ja,
         
     | 
| 119 | 
         
            +
                },
         
     | 
| 120 | 
         
            +
                python_requires=">=3.9.0, <3.12",
         
     | 
| 121 | 
         
            +
                entry_points={"console_scripts": ["tts=TTS.bin.synthesize:main", "tts-server = TTS.server.server:main"]},
         
     | 
| 122 | 
         
            +
                classifiers=[
         
     | 
| 123 | 
         
            +
                    "Programming Language :: Python",
         
     | 
| 124 | 
         
            +
                    "Programming Language :: Python :: 3",
         
     | 
| 125 | 
         
            +
                    "Programming Language :: Python :: 3.9",
         
     | 
| 126 | 
         
            +
                    "Programming Language :: Python :: 3.10",
         
     | 
| 127 | 
         
            +
                    "Programming Language :: Python :: 3.11",
         
     | 
| 128 | 
         
            +
                    "Development Status :: 3 - Alpha",
         
     | 
| 129 | 
         
            +
                    "Intended Audience :: Science/Research",
         
     | 
| 130 | 
         
            +
                    "Intended Audience :: Developers",
         
     | 
| 131 | 
         
            +
                    "Operating System :: POSIX :: Linux",
         
     | 
| 132 | 
         
            +
                    "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
         
     | 
| 133 | 
         
            +
                    "Topic :: Software Development",
         
     | 
| 134 | 
         
            +
                    "Topic :: Software Development :: Libraries :: Python Modules",
         
     | 
| 135 | 
         
            +
                    "Topic :: Multimedia :: Sound/Audio :: Speech",
         
     | 
| 136 | 
         
            +
                    "Topic :: Multimedia :: Sound/Audio",
         
     | 
| 137 | 
         
            +
                    "Topic :: Multimedia",
         
     | 
| 138 | 
         
            +
                    "Topic :: Scientific/Engineering :: Artificial Intelligence",
         
     | 
| 139 | 
         
            +
                ],
         
     | 
| 140 | 
         
            +
                zip_safe=False,
         
     | 
| 141 | 
         
            +
            )
         
     | 
| 142 | 
         
            +
             
     | 
| 143 | 
         
             
            import gradio as gr
         
     | 
| 144 | 
         
             
            import torch
         
     | 
| 145 | 
         
             
            from TTS.api import TTS
         
     |