Skip to content

Commit b4fded6

Browse files
authored
Merge pull request #15 from eginhard/server-extra
build: make dependencies for server optional
2 parents 68680ef + 7673f28 commit b4fded6

8 files changed

+21
-12
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ If you plan to code or train models, clone 🐸TTS and install it locally.
156156

157157
```bash
158158
git clone https://github.com/coqui-ai/TTS
159-
pip install -e .[all,dev,notebooks] # Select the relevant extras
159+
pip install -e .[all,dev,notebooks,server] # Select the relevant extras
160160
```
161161

162162
If you are on Ubuntu (Debian), you can also run following commands for installation.

TTS/server/README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# :frog: TTS demo server
2-
Before you use the server, make sure you [install](https://github.com/coqui-ai/TTS/tree/dev#install-tts)) :frog: TTS properly. Then, you can follow the steps below.
2+
Before you use the server, make sure you
3+
[install](https://github.com/coqui-ai/TTS/tree/dev#install-tts)) :frog: TTS
4+
properly and install the additional dependencies with `pip install
5+
TTS[server]`. Then, you can follow the steps below.
36

47
**Note:** If you install :frog:TTS using ```pip```, you can also use the ```tts-server``` end point on the terminal.
58

TTS/server/server.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
from typing import Union
1010
from urllib.parse import parse_qs
1111

12-
from flask import Flask, render_template, render_template_string, request, send_file
12+
try:
13+
from flask import Flask, render_template, render_template_string, request, send_file
14+
except ImportError as e:
15+
raise ImportError("Server requires requires flask, use `pip install TTS[server]`.") from e
1316

1417
from TTS.config import load_config
1518
from TTS.utils.manage import ModelManager

docs/source/inference.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ tts --model_name "voice_conversion/<language>/<dataset>/<model_name>"
8484
<!-- <img src="https://raw.githubusercontent.com/coqui-ai/TTS/main/images/demo_server.gif" height="56"/> -->
8585
![server.gif](https://github.com/coqui-ai/TTS/raw/main/images/demo_server.gif)
8686

87-
You can boot up a demo 🐸TTS server to run an inference with your models. Note that the server is not optimized for performance
88-
but gives you an easy way to interact with the models.
87+
You can boot up a demo 🐸TTS server to run an inference with your models (make
88+
sure to install the additional dependencies with `pip install TTS[server]`).
89+
Note that the server is not optimized for performance but gives you an easy way
90+
to interact with the models.
8991

9092
The demo server provides pretty much the same interface as the CLI command.
9193

docs/source/installation.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Installation
22

3-
🐸TTS supports python >=3.7 <3.11.0 and tested on Ubuntu 18.10, 19.10, 20.10.
3+
🐸TTS supports python >=3.9 <3.12.0 and tested on Ubuntu 18.10, 19.10, 20.10.
44

55
## Using `pip`
66

@@ -30,4 +30,4 @@ make install
3030
```
3131

3232
## On Windows
33-
If you are on Windows, 👑@GuyPaddock wrote installation instructions [here](https://stackoverflow.com/questions/66726331/
33+
If you are on Windows, 👑@GuyPaddock wrote installation instructions [here](https://stackoverflow.com/questions/66726331/

docs/source/tutorial_for_nervous_beginners.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ $ tts --list_models # list the available models.
112112
![cli.gif](https://github.com/coqui-ai/TTS/raw/main/images/tts_cli.gif)
113113

114114

115-
You can call `tts-server` to start a local demo server that you can open it on
116-
your favorite web browser and 🗣️.
115+
You can call `tts-server` to start a local demo server that you can open on
116+
your favorite web browser and 🗣️ (make sure to install the additional
117+
dependencies with `pip install TTS[server]`).
117118

118119
```bash
119120
$ tts-server -h # see the help

requirements.txt

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ pyyaml>=6.0
1313
fsspec[http]>=2023.6.0 # <= 2023.9.1 makes aux tests fail
1414
packaging>=23.1
1515
mutagen==1.47.0
16-
# deps for examples
17-
flask>=2.0.1
1816
# deps for inference
1917
pysbd>=0.3.4
2018
# deps for notebooks

setup.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ def pip_install(package_name):
6666
requirements_dev = f.readlines()
6767
with open(os.path.join(cwd, "requirements.ja.txt"), "r") as f:
6868
requirements_ja = f.readlines()
69-
requirements_all = requirements_dev + requirements_notebooks + requirements_ja
69+
requirements_server = ["flask>=2.0.1"]
70+
requirements_all = requirements_dev + requirements_notebooks + requirements_ja + requirements_server
7071

7172
with open("README.md", "r", encoding="utf-8") as readme_file:
7273
README = readme_file.read()
@@ -115,6 +116,7 @@ def pip_install(package_name):
115116
"all": requirements_all,
116117
"dev": requirements_dev,
117118
"notebooks": requirements_notebooks,
119+
"server": requirements_server,
118120
"ja": requirements_ja,
119121
},
120122
python_requires=">=3.9.0, <3.12",

0 commit comments

Comments
 (0)