Spaces:
Sleeping
Sleeping
constinic@gmail.com commited on
Commit ·
481b709
1
Parent(s): 5a5612c
change client
Browse files
app.py
CHANGED
|
@@ -17,9 +17,7 @@ from lib.infer_pack.models import (
|
|
| 17 |
SynthesizerTrnMs768NSFsid,
|
| 18 |
SynthesizerTrnMs768NSFsid_nono,
|
| 19 |
)
|
| 20 |
-
|
| 21 |
-
from flask import Flask, request, jsonify
|
| 22 |
-
from threading import Thread
|
| 23 |
from rmvpe import RMVPE
|
| 24 |
from vc_infer_pipeline import VC
|
| 25 |
|
|
@@ -33,8 +31,6 @@ limitation = os.getenv("SYSTEM") == "spaces"
|
|
| 33 |
|
| 34 |
config = Config()
|
| 35 |
|
| 36 |
-
app_flask= Flask(__name__)
|
| 37 |
-
|
| 38 |
edge_output_filename = "edge_output.mp3"
|
| 39 |
tts_voice_list = asyncio.get_event_loop().run_until_complete(edge_tts.list_voices())
|
| 40 |
tts_voices = [f"{v['ShortName']}-{v['Gender']}" for v in tts_voice_list]
|
|
@@ -237,28 +233,7 @@ This is a text-to-speech webui of RVC models.
|
|
| 237 |
|
| 238 |
Input text ➡[(edge-tts)](https://github.com/rany2/edge-tts)➡ Speech mp3 file ➡[(RVC)](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI)➡ Final output
|
| 239 |
"""
|
| 240 |
-
|
| 241 |
-
'Content-type':'application/json',
|
| 242 |
-
'Accept':'application/json'
|
| 243 |
-
}
|
| 244 |
-
@app_flask.route('/receive_data', methods=['POST'])
|
| 245 |
-
def receive_data():
|
| 246 |
-
data = request.json
|
| 247 |
-
model_name = data.get('model_name')
|
| 248 |
-
speed= data.get('speed')
|
| 249 |
-
headers=headers
|
| 250 |
-
print("Received data:", data)
|
| 251 |
-
return 'Data received by Flask'
|
| 252 |
-
|
| 253 |
-
@app_flask.route('/api', methods=['GET'])
|
| 254 |
-
def show_data():
|
| 255 |
-
data={
|
| 256 |
-
'message': tts_text.value,
|
| 257 |
-
'status': 'success'
|
| 258 |
-
}
|
| 259 |
-
but0.click()
|
| 260 |
-
tts_text.value="hola"
|
| 261 |
-
return jsonify(data)
|
| 262 |
|
| 263 |
|
| 264 |
|
|
@@ -391,14 +366,6 @@ with app:
|
|
| 391 |
inputs=[tts_text, tts_voice],
|
| 392 |
)
|
| 393 |
|
| 394 |
-
def run_flask_app():
|
| 395 |
-
app_flask.run()
|
| 396 |
-
|
| 397 |
-
if __name__ == '__main__':
|
| 398 |
-
# flask en hilo secundario
|
| 399 |
-
flask_thread = Thread(target=run_flask_app)
|
| 400 |
-
flask_thread.daemon= True
|
| 401 |
-
flask_thread.start()
|
| 402 |
|
| 403 |
# gradio en principal
|
| 404 |
app.launch(inbrowser=True)
|
|
|
|
| 17 |
SynthesizerTrnMs768NSFsid,
|
| 18 |
SynthesizerTrnMs768NSFsid_nono,
|
| 19 |
)
|
| 20 |
+
|
|
|
|
|
|
|
| 21 |
from rmvpe import RMVPE
|
| 22 |
from vc_infer_pipeline import VC
|
| 23 |
|
|
|
|
| 31 |
|
| 32 |
config = Config()
|
| 33 |
|
|
|
|
|
|
|
| 34 |
edge_output_filename = "edge_output.mp3"
|
| 35 |
tts_voice_list = asyncio.get_event_loop().run_until_complete(edge_tts.list_voices())
|
| 36 |
tts_voices = [f"{v['ShortName']}-{v['Gender']}" for v in tts_voice_list]
|
|
|
|
| 233 |
|
| 234 |
Input text ➡[(edge-tts)](https://github.com/rany2/edge-tts)➡ Speech mp3 file ➡[(RVC)](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI)➡ Final output
|
| 235 |
"""
|
| 236 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
|
| 238 |
|
| 239 |
|
|
|
|
| 366 |
inputs=[tts_text, tts_voice],
|
| 367 |
)
|
| 368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 369 |
|
| 370 |
# gradio en principal
|
| 371 |
app.launch(inbrowser=True)
|