|
import streamlit as st |
|
import os |
|
import requests |
|
|
|
|
|
st.title("Voice Cloning Application") |
|
|
|
|
|
uploaded_file = st.file_uploader("Upload a voice recording (First Time)", type=["wav", "mp3"]) |
|
|
|
if uploaded_file is not None: |
|
|
|
with open("user_voice.wav", "wb") as f: |
|
f.write(uploaded_file.getbuffer()) |
|
|
|
st.write("Your voice has been uploaded. Now we will clone your voice.") |
|
|
|
|
|
user_voice_path = "user_voice.wav" |
|
|
|
|
|
|
|
st.write(f"Voice stored at {user_voice_path}") |
|
|
|
|
|
response = requests.post("https://your-colab-backend-url", files={"file": open(user_voice_path, "rb")}) |
|
|
|
if response.status_code == 200: |
|
st.write("Voice fine-tuning completed successfully!") |
|
else: |
|
st.write("Error in fine-tuning the voice.") |
|
|
|
|
|
uploaded_file = st.file_uploader("Upload a text to clone your voice", type=["txt"]) |
|
|
|
if uploaded_file is not None: |
|
|
|
with open("user_text.txt", "w") as f: |
|
f.write(uploaded_file.getvalue().decode("utf-8")) |
|
|
|
|
|
cloned_voice = requests.post("https://your-colab-backend-url", files={"file": open("user_text.txt", "rb")}).content |
|
|
|
|
|
st.audio(cloned_voice, format="audio/wav") |
|
st.write("Voice cloned successfully!") |
|
import requests |
|
|
|
def groq_accelerate(audio_file_path): |
|
url = "https://groq.api/accelerate" |
|
headers = {"Authorization": "Bearer YOUR_GROQ_API_KEY"} |
|
|
|
|
|
audio_file = open(audio_file_path, "rb") |
|
response = requests.post(url, headers=headers, files={"file": audio_file}) |
|
|
|
|
|
return response.content |
|
|
|
|
|
|