File size: 2,478 Bytes
3c8c071 |
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
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.")
|