cotxetj commited on
Commit
d11d590
1 Parent(s): e0b1de2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -42,7 +42,7 @@ def speech_to_speech_translation(audio):
42
  synthesised_speech = synthesise(translated_text)
43
  synthesised_speech = (
44
  synthesised_speech.numpy() * 32767).astype(np.int16)
45
- return "", synthesised_speech
46
 
47
  def predict(transType, language, audio, audio_mic = None):
48
  print("debug1:", audio,"debug2", audio_mic)
@@ -52,7 +52,7 @@ def predict(transType, language, audio, audio_mic = None):
52
  if transType == "Text":
53
  return translate(audio), None
54
  if transType == "Audio":
55
- return speech_to_speech_translation(audio)
56
 
57
  # Define the title etc
58
  title = "Swedish STSOT (Speech To Speech Or Text)"
@@ -62,11 +62,10 @@ description="Use Whisper pretrained model to convert swedish audio to english (t
62
  supportLangs = ["Swedish", "French (in training)"]
63
  transTypes = ["Text", "Audio"]
64
 
65
- # examples = [
66
- # ["Text", "Swedish", "ex1.mp3", None],
67
- # ["Audio", "Swedish", "ex2.mp3", None]
68
- # ]
69
- examples = []
70
  demo = gr.Interface(
71
  fn=predict,
72
  inputs=[
 
42
  synthesised_speech = synthesise(translated_text)
43
  synthesised_speech = (
44
  synthesised_speech.numpy() * 32767).astype(np.int16)
45
+ return [16000, synthesised_speech]
46
 
47
  def predict(transType, language, audio, audio_mic = None):
48
  print("debug1:", audio,"debug2", audio_mic)
 
52
  if transType == "Text":
53
  return translate(audio), None
54
  if transType == "Audio":
55
+ return "",speech_to_speech_translation(audio)
56
 
57
  # Define the title etc
58
  title = "Swedish STSOT (Speech To Speech Or Text)"
 
62
  supportLangs = ["Swedish", "French (in training)"]
63
  transTypes = ["Text", "Audio"]
64
 
65
+ examples = [
66
+ ["Text", "Swedish", "./ex1.wav", None],
67
+ ["Audio", "Swedish", "./ex2.wav", None]
68
+ ]
 
69
  demo = gr.Interface(
70
  fn=predict,
71
  inputs=[