🔍 Crx搜搜
FireTTS
dishdare
(1 人评分) |1 位用户 | 来自
商店
|

概述
翻译

Text to Speech solution using locally installed TTS. Repo - https://github.com/coqui-ai/TTS steps to install coqui-ai/TTS locally conda create --name tts python=3.11 jupyter -y conda activate tts pip install tts flask flask-cors sudo apt install ffmpeg create the server file and run it - server.py server.py from flask import Flask, request from flask_cors import CORS import subprocess import os app = Flask(__name__) CORS(app) # Define output path OUTPUT_DIR = os.path.expanduser("~/tts") OUTPUT_FILE = os.path.join(OUTPUT_DIR, "output.wav") @app.route("/speak", methods=["POST"]) def speak(): text = request.json.get("text", "") print("Received text:", repr(text)) if not text: return {"error": "No text provided"}, 400 # Create output folder if it doesn't exist os.makedirs(OUTPUT_DIR, exist_ok=True) # Build and run the TTS command safely subprocess.run([ "conda", "run", "-n", "tts", "tts", "--text", text, "--model_name", "tts_models/en/ljspeech/glow-tts", "--out_path", OUTPUT_FILE ]) # Notify user os.system(f'notify-send "TTS" "Speaking: {text[:80]}..."') # Play the generated audio subprocess.run(["ffplay", "-nodisp", "-autoexit", OUTPUT_FILE]) return {"status": "done"} if __name__ == "__main__": print("Starting server...") app.run(port=5002, debug=True) Enjoy Freedom of Speech. My first extension. Please let me know if there are any issues or solutions. Special thanks to ChatGPT.

来自商店的评价 (0)

尚无人评价此扩展

留言