lalalic commited on
Commit
e4bf4e7
·
verified ·
1 Parent(s): 6b7d708

Update xtts.py

Browse files
Files changed (1) hide show
  1. xtts.py +7 -4
xtts.py CHANGED
@@ -10,6 +10,7 @@ from flask import Flask, Blueprint, request, jsonify, send_file
10
 
11
  import torch
12
  import torchaudio
 
13
 
14
  app = Flask(__name__)
15
  # def upload_bytes(bytes, ext=".wav"):
@@ -40,12 +41,13 @@ except:
40
  tts=None
41
  model=None
42
  @app.route("/convert")
43
- def predict():
44
  global tts
45
  global model
46
- text = request.args.get('text')
47
- sample = request.args.get('sample')
48
- language = request.args.get('language')
 
49
 
50
  if text is None:
51
  return jsonify({'error': 'text is missing'}), 400
@@ -148,3 +150,4 @@ def trim_sample_audio(speaker_wav):
148
  traceback.print_exc()
149
  return speaker_wav
150
 
 
 
10
 
11
  import torch
12
  import torchaudio
13
+ import gradio as gr
14
 
15
  app = Flask(__name__)
16
  # def upload_bytes(bytes, ext=".wav"):
 
41
  tts=None
42
  model=None
43
  @app.route("/convert")
44
+ def predict(text, sample):
45
  global tts
46
  global model
47
+ if request is not None:
48
+ text = request.args.get('text')
49
+ sample = request.args.get('sample')
50
+ language = request.args.get('language')
51
 
52
  if text is None:
53
  return jsonify({'error': 'text is missing'}), 400
 
150
  traceback.print_exc()
151
  return speaker_wav
152
 
153
+ gr.Inference(predict, inputs=["text", "text"], outputs="text").launch()