CRIMJOBBERS commited on
Commit
2d4d59c
·
verified ·
1 Parent(s): b4191f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -77,7 +77,7 @@ def translate(text, direction, tone):
77
 
78
  return f"{warning}\n{translation}" if warning else translation
79
 
80
- # TTS using Hugging Face Inference API
81
  def tts_via_api(text):
82
  api_token = os.getenv("HUGGINGFACEHUB_API_TOKEN")
83
  if not api_token:
@@ -92,7 +92,7 @@ def tts_via_api(text):
92
  }
93
 
94
  response = requests.post(
95
- "https://api-inference.huggingface.co/models/microsoft/speecht5_tts",
96
  headers=headers,
97
  json=payload
98
  )
@@ -102,6 +102,7 @@ def tts_via_api(text):
102
  tmp.write(response.content)
103
  return tmp.name
104
  else:
 
105
  return None
106
 
107
  def transcribe_and_translate(audio_path, direction, tone):
 
77
 
78
  return f"{warning}\n{translation}" if warning else translation
79
 
80
+ #new tts_via_api function with this:
81
  def tts_via_api(text):
82
  api_token = os.getenv("HUGGINGFACEHUB_API_TOKEN")
83
  if not api_token:
 
92
  }
93
 
94
  response = requests.post(
95
+ "https://api-inference.huggingface.co/models/espnet/kan-bayashi_ljspeech_vits",
96
  headers=headers,
97
  json=payload
98
  )
 
102
  tmp.write(response.content)
103
  return tmp.name
104
  else:
105
+ print("TTS API Error:", response.status_code, response.text)
106
  return None
107
 
108
  def transcribe_and_translate(audio_path, direction, tone):