Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from inference import InferencePipeline | |
| i = InferencePipeline() | |
| def gradio_voice_conversion(audio_file_path): | |
| """ | |
| Wrapper function to handle Gradio's audio input and pass the file path to the voice conversion function. | |
| Gradio passes audio data as a tuple: (temp file path, sample rate). | |
| """ | |
| # Gradio passes audio as (temp file path, sample rate) | |
| #audio_file_path = audio_data[0] # Extract the file path | |
| print(f"Here is the audio_file_path: {audio_file_path}") | |
| #print(f"Here is the audio_file_path[0]: {audio_file_path[0]}") | |
| return i.voice_conversion(audio_file_path) | |
| # Define your Gradio interface | |
| demo = gr.Interface( | |
| fn=gradio_voice_conversion, # Use the wrapper function for voice conversion | |
| inputs=gr.Audio(label="Record or upload your voice", type="filepath"), # Specify that you want the filepath | |
| outputs=gr.Audio(label="Converted Voice"), | |
| title="Voice Conversion Demo", | |
| description="Voice Conversion: Transform the input voice to a target voice.", | |
| allow_flagging="never" | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() | |