ronniet commited on
Commit
1c09801
1 Parent(s): 824c135

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,13 +1,17 @@
1
  import gradio as gr
2
  from transformers import pipeline
 
3
 
4
  captioner = pipeline(model="microsoft/git-base")
5
- tts = pipeline(model="suno/bark-small")
6
 
7
  def predict(image):
8
  text = captioner(image)[0]["generated_text"]
9
- audio = tts(text)["audio"]
10
- return text, audio
 
 
 
11
 
12
  demo = gr.Interface(
13
  fn=predict,
 
1
  import gradio as gr
2
  from transformers import pipeline
3
+ from TTS.api import TTS
4
 
5
  captioner = pipeline(model="microsoft/git-base")
6
+ tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts", progress_bar=False, gpu=False)
7
 
8
  def predict(image):
9
  text = captioner(image)[0]["generated_text"]
10
+
11
+ audio_output = "output.wav"
12
+ tts.tts_to_file(text, speaker=tts.speakers[0], language="en", file_path=audio_output)
13
+
14
+ return text, audio_output
15
 
16
  demo = gr.Interface(
17
  fn=predict,