Spaces:
No application file
No application file
File size: 738 Bytes
b9b74eb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import gradio as gr
import soundfile as sf
from tango import Tango
import IPython.display as ipd
# Initialize the Tango model
tango = Tango("declare-lab/tango-full-ft-audiocaps")
# Function to generate audio from text prompt
def generate_audio(prompt):
# Generate audio from the prompt
audio = tango.generate(prompt)
# Save the audio to a file
file_path = f"{prompt}.wav"
sf.write(file_path, audio, samplerate=16000)
return file_path
# Gradio interface
interface = gr.Interface(
fn=generate_audio,
inputs="text",
outputs="audio",
title="Audio Generation with Tango",
description="Enter a prompt to generate an audio description using the Tango model."
)
# Launch the app
interface.launch()
|