Update app.py
Browse files
app.py
CHANGED
|
@@ -1,51 +1,32 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import
|
| 3 |
-
import
|
| 4 |
-
from
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
# Set your OpenAI API key here
|
| 8 |
-
openai.api_key = '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'
|
| 9 |
-
|
| 10 |
-
def generate_audio(text):
|
| 11 |
-
"""Generate audio using OpenAI API"""
|
| 12 |
-
response = openai.Audio.create(
|
| 13 |
-
model="text-to-speech",
|
| 14 |
-
prompt=text
|
| 15 |
-
)
|
| 16 |
-
audio_file = response['audio']
|
| 17 |
-
return audio_file
|
| 18 |
-
|
| 19 |
-
def transcribe_audio(file):
|
| 20 |
-
"""Transcribe audio file to text"""
|
| 21 |
-
audio = AudioSegment.from_file(file)
|
| 22 |
-
audio_array = np.array(audio.get_array_of_samples())
|
| 23 |
-
# Transcribe using OpenAI API (pseudo code)
|
| 24 |
-
response = openai.Audio.transcribe(
|
| 25 |
-
model="whisper-1",
|
| 26 |
-
audio=audio_array.tolist()
|
| 27 |
-
)
|
| 28 |
-
return response['text']
|
| 29 |
|
| 30 |
def main():
|
| 31 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
| 40 |
|
| 41 |
-
|
| 42 |
-
st.
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
transcription = transcribe_audio(audio_file)
|
| 47 |
-
st.write("Transcription:")
|
| 48 |
-
st.write(transcription)
|
| 49 |
|
| 50 |
if __name__ == "__main__":
|
| 51 |
main()
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from components.home import show_home
|
| 3 |
+
from components.voice_cloning import show_voice_cloning
|
| 4 |
+
from components.speech_restoration import show_speech_restoration
|
| 5 |
+
from components.historical_personalities import show_historical_personalities
|
| 6 |
+
from utils.session_state import initialize_session_state
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def main():
|
| 9 |
+
st.set_page_config(page_title="MyVoice AI", page_icon="🎙️", layout="wide")
|
| 10 |
+
initialize_session_state()
|
| 11 |
+
|
| 12 |
+
st.sidebar.title("MyVoice AI")
|
| 13 |
+
menu = ["Home", "Voice Cloning", "Speech Restoration", "Historical Personalities"]
|
| 14 |
+
choice = st.sidebar.selectbox("Menu", menu)
|
| 15 |
|
| 16 |
+
if choice == "Home":
|
| 17 |
+
show_home()
|
| 18 |
+
elif choice == "Voice Cloning":
|
| 19 |
+
show_voice_cloning()
|
| 20 |
+
elif choice == "Speech Restoration":
|
| 21 |
+
show_speech_restoration()
|
| 22 |
+
elif choice == "Historical Personalities":
|
| 23 |
+
show_historical_personalities()
|
| 24 |
|
| 25 |
+
st.sidebar.title("About")
|
| 26 |
+
st.sidebar.info("""
|
| 27 |
+
MyVoice AI revolutionizes human communication and preserves meaningful connections
|
| 28 |
+
through advanced audio processing technology.
|
| 29 |
+
""")
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
if __name__ == "__main__":
|
| 32 |
main()
|