Update app.py
Browse files
app.py
CHANGED
|
@@ -1,37 +1,31 @@
|
|
| 1 |
-
|
| 2 |
import os
|
|
|
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
-
os.makedirs(UPLOAD_FOLDER, exist_ok=True)
|
| 7 |
-
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
| 8 |
-
|
| 9 |
-
# Allowed file extensions
|
| 10 |
-
ALLOWED_EXTENSIONS = {'wav', 'mp3', 'ogg'}
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
if 'file' not in request.files:
|
| 23 |
-
return jsonify({"message": "No file part"}), 400
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
| 33 |
else:
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
if __name__ == "__main__":
|
| 37 |
-
app.run(debug=True)
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
import os
|
| 3 |
+
import requests
|
| 4 |
|
| 5 |
+
# Title for the Streamlit app
|
| 6 |
+
st.title("Voice Cloning Application")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
# File uploader to upload a voice recording
|
| 9 |
+
uploaded_file = st.file_uploader("Upload a voice recording (First Time)", type=["wav", "mp3"])
|
|
|
|
| 10 |
|
| 11 |
+
if uploaded_file is not None:
|
| 12 |
+
# Save the uploaded file locally
|
| 13 |
+
with open("user_voice.wav", "wb") as f:
|
| 14 |
+
f.write(uploaded_file.getbuffer())
|
| 15 |
+
|
| 16 |
+
st.write("Your voice has been uploaded. Now we will clone your voice.")
|
| 17 |
|
| 18 |
+
# Simulate storing the voice in a "database" (for simplicity, store it in the file system)
|
| 19 |
+
user_voice_path = "user_voice.wav"
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
# You could use Groq or other ML acceleration API here to fine-tune the model
|
| 22 |
+
# Save user voice for future use (in real-life, this would be stored in a database)
|
| 23 |
+
st.write(f"Voice stored at {user_voice_path}")
|
| 24 |
|
| 25 |
+
# You can call your backend (Google Colab) to fine-tune the voice model
|
| 26 |
+
response = requests.post("https://your-colab-backend-url", files={"file": open(user_voice_path, "rb")})
|
| 27 |
+
|
| 28 |
+
if response.status_code == 200:
|
| 29 |
+
st.write("Voice fine-tuning completed successfully!")
|
| 30 |
else:
|
| 31 |
+
st.write("Error in fine-tuning the voice.")
|
|
|
|
|
|
|
|
|