Abrahamau commited on
Commit
460308e
·
verified ·
1 Parent(s): 0119bfc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -23,12 +23,14 @@ def guessanAge(model, image):
23
 
24
  def text2speech(model, text):
25
  if len(text) > 0:
26
- speechclassifier = pipeline("text-to-speech", model=model)
 
27
  embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
28
  speaker_embedding = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
29
- output = speechclassifier(text)
30
- print(output, type(output) )
31
- return output
 
32
 
33
  radio1 = gr.Radio(["microsoft/resnet-50", "google/vit-base-patch16-224", "apple/mobilevit-small"], label="Select a Classifier", info="Image Classifier")
34
  tab1 = gr.Interface(
 
23
 
24
  def text2speech(model, text):
25
  if len(text) > 0:
26
+ synthesiser = pipeline("text-to-speech", model=model)
27
+
28
  embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
29
  speaker_embedding = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
30
+
31
+ speech = synthesiser(text, forward_params={"speaker_embeddings": speaker_embedding})
32
+ print(speech, type(speech) )
33
+ return speech
34
 
35
  radio1 = gr.Radio(["microsoft/resnet-50", "google/vit-base-patch16-224", "apple/mobilevit-small"], label="Select a Classifier", info="Image Classifier")
36
  tab1 = gr.Interface(