meraj12 commited on
Commit
8d6ad31
·
verified ·
1 Parent(s): ff0b1fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -33
app.py CHANGED
@@ -1,4 +1,4 @@
1
-
2
  import requests
3
  from io import BytesIO
4
 
@@ -11,38 +11,7 @@ uploaded_file = st.file_uploader("Upload an audio file (MP3, WAV)", type=['mp3',
11
  # Function to send audio file to the backend (Google Colab)
12
  def send_to_backend(audio_file):
13
  # Make sure your Google Colab or API is set up to accept POST requests with audio data
14
- url = 'import streamlit as st
15
- import requests
16
- from io import BytesIO
17
-
18
- # Title of the app
19
- st.title('Voice Cloning App')
20
-
21
- # File uploader widget for uploading the voice recording
22
- uploaded_file = st.file_uploader("Upload an audio file (MP3, WAV)", type=['mp3', 'wav'])
23
-
24
- # Function to send audio file to the backend (Google Colab)
25
- def send_to_backend(audio_file):
26
- # Make sure your Google Colab or API is set up to accept POST requests with audio data
27
- url = '>' # replace with your backend API URL
28
- files = {'file': audio_file}
29
- response = requests.post(url, files=files)
30
- return response
31
-
32
- # Display the uploaded file and send it for processing
33
- if uploaded_file is not None:
34
- st.audio(uploaded_file, format='audio/wav')
35
-
36
- # Process the file and return the cloned voice (assuming backend returns a file URL or the file itself)
37
- with st.spinner("Processing..."):
38
- result = send_to_backend(uploaded_file)
39
- if result.status_code == 200:
40
- # If the result is successful, display the cloned audio
41
- st.success('Voice cloned successfully!')
42
- st.audio(result.content, format='audio/wav')
43
- else:
44
- st.error("Error in processing the voice cloning. Please try again.")
45
- >' # replace with your backend API URL
46
  files = {'file': audio_file}
47
  response = requests.post(url, files=files)
48
  return response
 
1
+ import streamlit as st
2
  import requests
3
  from io import BytesIO
4
 
 
11
  # Function to send audio file to the backend (Google Colab)
12
  def send_to_backend(audio_file):
13
  # Make sure your Google Colab or API is set up to accept POST requests with audio data
14
+ url = 'https://<your-backend-url>' # replace with your backend API URL
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  files = {'file': audio_file}
16
  response = requests.post(url, files=files)
17
  return response