|
import gradio as gr |
|
import torchaudio |
|
from transformers import pipeline |
|
|
|
|
|
|
|
|
|
def voice_cloning(input_audio, song_text, musician_style): |
|
|
|
waveform, sample_rate = torchaudio.load(input_audio) |
|
|
|
|
|
|
|
cloned_voice = f"Processed your voice for song '{song_text}' in the style of {musician_style}" |
|
|
|
|
|
|
|
synthesized_song = f"Singing '{song_text}' with your voice in the style of {musician_style}." |
|
|
|
return synthesized_song |
|
|
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown("### Voice Cloning & Singing in a Musician's Style") |
|
|
|
with gr.Row(): |
|
input_audio = gr.Audio(label="Upload Your Voice", type="filepath") |
|
song_text = gr.Textbox(label="Enter Song Lyrics", placeholder="Enter the song lyrics here...") |
|
musician_style = gr.Textbox(label="Enter Musician's Style", placeholder="e.g., Adele, Ed Sheeran, etc.") |
|
|
|
output = gr.Textbox(label="Synthesized Song") |
|
|
|
generate_button = gr.Button("Generate") |
|
generate_button.click( |
|
voice_cloning, |
|
inputs=[input_audio, song_text, musician_style], |
|
outputs=output |
|
) |
|
|
|
|
|
demo.launch() |
|
|
|
|