bisoye's picture
Upload 3 files
132646e verified
raw
history blame
No virus
738 Bytes
import gradio as gr
from transformers import pipeline
def process_files():
return (gr.update(interactive=True,
elem_id='summary_button'),
gr.update(interactive = True, elem_id = 'summarization_method')
)
def get_summarization_method(option):
return option
def text_to_audio(text, model_name="facebook/fastspeech2-en-ljspeech"):
# Initialize the TTS pipeline
tts_pipeline = pipeline("text-to-speech", model=model_name)
# Generate the audio from text
audio = tts_pipeline(text)
# Save the audio to a file
audio_path = "output.wav"
with open(audio_path, "wb") as file:
file.write(audio["wav"])
return audio_path