Download IndicTTS/inference/socket_proxy/te_endpoint.py from byanzene/indic_trans_sample: direct link, hf CLI and curl.
- Browser
- Download file 667 Bytes
-
https://huggingface.co/byanzene/indic_trans_sample/resolve/main/IndicTTS/inference/socket_proxy/te_endpoint.py
- Command line
-
hf download hf://byanzene/indic_trans_sample/IndicTTS/inference/socket_proxy/te_endpoint.py
-
curl -L -o te_endpoint.py https://huggingface.co/byanzene/indic_trans_sample/resolve/main/IndicTTS/inference/socket_proxy/te_endpoint.py
667 Bytes
| import io | |
| import requests | |
| from flask import Flask | |
| from flask_socketio import SocketIO,emit | |
| app = Flask(__name__) | |
| socketio = SocketIO(app, async_mode='eventlet', cors_allowed_origins="*", path='tts_socket.io', async_handlers=True, pingTimeout=60000) | |
| api_url = "http://localhost:5050" | |
| # api_url = "https://tts-api.ai4bharat.org/" | |
| def connection(x): | |
| emit('connect','Connected tts') | |
| return 'connected' | |
| def infer(request_body): | |
| return requests.post(api_url, json=request_body).json() | |
| if __name__ == '__main__': | |
| socketio.run(app, host="0.0.0.0", port=5001, debug=True) | |