Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,15 +6,21 @@ import io
|
|
| 6 |
st.markdown(
|
| 7 |
"""
|
| 8 |
<style>
|
| 9 |
-
.
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
}
|
| 14 |
-
.
|
| 15 |
background-color: #f0f2f6;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
-
.
|
| 18 |
background-color: #006699;
|
| 19 |
color: white;
|
| 20 |
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
@@ -28,12 +34,13 @@ st.markdown(
|
|
| 28 |
)
|
| 29 |
|
| 30 |
def main():
|
| 31 |
-
st.title("
|
| 32 |
-
st.
|
| 33 |
|
| 34 |
-
|
|
|
|
| 35 |
|
| 36 |
-
if mode == 'Text
|
| 37 |
st.subheader('Convert Text to Speech')
|
| 38 |
input_text = st.text_area("Enter the text here")
|
| 39 |
if st.button("Generate Audio", key="generate_audio") and input_text:
|
|
@@ -41,12 +48,14 @@ def main():
|
|
| 41 |
if response:
|
| 42 |
st.audio(io.BytesIO(response.content), format='audio/mp3')
|
| 43 |
|
| 44 |
-
elif mode == 'Speech
|
| 45 |
st.subheader('Convert Speech to Text')
|
| 46 |
audio_uploaded = st.file_uploader("Upload your audio file", type=['mp3', 'wav'])
|
| 47 |
if st.button("Generate Transcript", key="generate_transcript") and audio_uploaded:
|
| 48 |
text = audio_to_text(audio_uploaded)
|
| 49 |
st.write(text)
|
| 50 |
|
|
|
|
|
|
|
| 51 |
if __name__ == '__main__':
|
| 52 |
main()
|
|
|
|
| 6 |
st.markdown(
|
| 7 |
"""
|
| 8 |
<style>
|
| 9 |
+
.header {
|
| 10 |
+
background-color: #006699;
|
| 11 |
+
padding: 20px;
|
| 12 |
+
color: white;
|
| 13 |
+
font-size: 24px;
|
| 14 |
+
text-align: center;
|
| 15 |
}
|
| 16 |
+
.footer {
|
| 17 |
background-color: #f0f2f6;
|
| 18 |
+
padding: 10px;
|
| 19 |
+
color: #666666;
|
| 20 |
+
font-size: 14px;
|
| 21 |
+
text-align: center;
|
| 22 |
}
|
| 23 |
+
.button {
|
| 24 |
background-color: #006699;
|
| 25 |
color: white;
|
| 26 |
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
|
|
| 34 |
)
|
| 35 |
|
| 36 |
def main():
|
| 37 |
+
st.title("GenAI Speech Transcriber")
|
| 38 |
+
st.markdown("<p class='header'>Convert Speech to Text or Text to Speech</p>", unsafe_allow_html=True)
|
| 39 |
|
| 40 |
+
st.sidebar.markdown("<p class='button'>Choose Mode</p>", unsafe_allow_html=True)
|
| 41 |
+
mode = st.sidebar.radio('', ('Speech to Text', 'Text to Speech'))
|
| 42 |
|
| 43 |
+
if mode == 'Text to Speech':
|
| 44 |
st.subheader('Convert Text to Speech')
|
| 45 |
input_text = st.text_area("Enter the text here")
|
| 46 |
if st.button("Generate Audio", key="generate_audio") and input_text:
|
|
|
|
| 48 |
if response:
|
| 49 |
st.audio(io.BytesIO(response.content), format='audio/mp3')
|
| 50 |
|
| 51 |
+
elif mode == 'Speech to Text':
|
| 52 |
st.subheader('Convert Speech to Text')
|
| 53 |
audio_uploaded = st.file_uploader("Upload your audio file", type=['mp3', 'wav'])
|
| 54 |
if st.button("Generate Transcript", key="generate_transcript") and audio_uploaded:
|
| 55 |
text = audio_to_text(audio_uploaded)
|
| 56 |
st.write(text)
|
| 57 |
|
| 58 |
+
st.markdown("<p class='footer'>Powered by GenAI</p>", unsafe_allow_html=True)
|
| 59 |
+
|
| 60 |
if __name__ == '__main__':
|
| 61 |
main()
|