TTS
TTS copied to clipboard
[Bug] occur a reference error when using it with flask_socketio
Describe the bug
When I import TTS module to my app.py(see the reproduce code), It will occur a reference error. When I don't import the TTS module, it can work well. I just want to use the flask_socketio to build a service to convert text to speech.
To Reproduce
the minimal reproducible code
from flask import Flask
from flask_socketio import SocketIO
import logging
from TTS.api import TTS
def create_app():
app = Flask(__name__)
return app
app = create_app()
socketio = SocketIO(
app,
path="/socket.io",
cors_allowed_origins="*",
logger=True,
engineio_logger=True,
)
if __name__ == "__main__":
host = "0.0.0.0"
port = 8172
app.logger.info(f"server listen on http://{host}:{port}")
socketio.run(app, host, port, debug=True)
- run this code
- you can see the error
requirements.txt
Flask==3.0.3
Requests==2.32.3
gevent==24.2.1
Flask-SocketIO==5.3.6
gevent-websocket==0.10.1
TTS==0.22.0
Expected behavior
No error. It can run successful.
Logs
No response
Environment
- 🐸TTS Version (e.g., 1.3.0): 0.22.0
- PyTorch Version (e.g., 1.8): 2.4.0
- Python version: 3.9.19
- OS (e.g., Linux): Mac OS 14.5
- CUDA/cuDNN version:
- GPU models and configuration:
- How you installed PyTorch (`conda`, `pip`, source): pip
- Any other relevant information:
the JSON by collect_env_info.py
{
"CUDA": {
"GPU": [],
"available": false,
"version": null
},
"Packages": {
"PyTorch_debug": false,
"PyTorch_version": "2.4.0",
"TTS": "0.22.0",
"numpy": "1.22.0"
},
"System": {
"OS": "Darwin",
"architecture": [
"64bit",
""
],
"processor": "arm",
"python": "3.9.19",
"version": "Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000"
}
}
Additional context
No response