Spaces:
Sleeping
Sleeping
import streamlit as st | |
import requests | |
from io import BytesIO | |
# Title of the app | |
st.title('Voice Cloning App') | |
# File uploader widget for uploading the voice recording | |
uploaded_file = st.file_uploader("Upload an audio file (MP3, WAV)", type=['mp3', 'wav']) | |
# Function to send audio file to the backend (Google Colab) | |
def send_to_backend(audio_file): | |
# Make sure your Google Colab or API is set up to accept POST requests with audio data | |
url = 'import streamlit as st | |
import requests | |
from io import BytesIO | |
# Title of the app | |
st.title('Voice Cloning App') | |
# File uploader widget for uploading the voice recording | |
uploaded_file = st.file_uploader("Upload an audio file (MP3, WAV)", type=['mp3', 'wav']) | |
# Function to send audio file to the backend (Google Colab) | |
def send_to_backend(audio_file): | |
# Make sure your Google Colab or API is set up to accept POST requests with audio data | |
url = '>' # replace with your backend API URL | |
files = {'file': audio_file} | |
response = requests.post(url, files=files) | |
return response | |
# Display the uploaded file and send it for processing | |
if uploaded_file is not None: | |
st.audio(uploaded_file, format='audio/wav') | |
# Process the file and return the cloned voice (assuming backend returns a file URL or the file itself) | |
with st.spinner("Processing..."): | |
result = send_to_backend(uploaded_file) | |
if result.status_code == 200: | |
# If the result is successful, display the cloned audio | |
st.success('Voice cloned successfully!') | |
st.audio(result.content, format='audio/wav') | |
else: | |
st.error("Error in processing the voice cloning. Please try again.") | |
>' # replace with your backend API URL | |
files = {'file': audio_file} | |
response = requests.post(url, files=files) | |
return response | |
# Display the uploaded file and send it for processing | |
if uploaded_file is not None: | |
st.audio(uploaded_file, format='audio/wav') | |
# Process the file and return the cloned voice (assuming backend returns a file URL or the file itself) | |
with st.spinner("Processing..."): | |
result = send_to_backend(uploaded_file) | |
if result.status_code == 200: | |
# If the result is successful, display the cloned audio | |
st.success('Voice cloned successfully!') | |
st.audio(result.content, format='audio/wav') | |
else: | |
st.error("Error in processing the voice cloning. Please try again.") | |