Update app.py
Browse files
app.py
CHANGED
|
@@ -100,6 +100,41 @@ else:
|
|
| 100 |
#st.warning('π Please enter Statement!')
|
| 101 |
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
################ STATEMENT SUMMARIZATION - side bar - pipeline #################
|
| 104 |
|
| 105 |
# Load the summarization model
|
|
@@ -122,8 +157,8 @@ if STATEMENT:
|
|
| 122 |
else:
|
| 123 |
st.sidebar.button('Summarize Statement2', disabled=True)
|
| 124 |
#st.warning('π Please enter Statement!')
|
| 125 |
-
|
| 126 |
|
|
|
|
| 127 |
|
| 128 |
# ################ CHAT BOT - main area #################
|
| 129 |
|
|
|
|
| 100 |
#st.warning('π Please enter Statement!')
|
| 101 |
|
| 102 |
|
| 103 |
+
################ TEXT TO SPEECH (TTS) - side bar - pipeline #################
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
from transformers import pipeline
|
| 107 |
+
# # Load the pipeline
|
| 108 |
+
tts = pipeline("text-to-speech")
|
| 109 |
+
|
| 110 |
+
st.sidebar.markdown("<h3 style='text-align: center; font-size: 16px; background-color: white; color: black;'>TTS - Pipeline</h3>", unsafe_allow_html=True)
|
| 111 |
+
DEFAULT_STATEMENT = ""
|
| 112 |
+
# Create a text area for user input
|
| 113 |
+
STATEMENT = st.sidebar.text_area('Enter Text', DEFAULT_STATEMENT, height=150)
|
| 114 |
+
|
| 115 |
+
# Enable the button only if there is text in the TTS variable
|
| 116 |
+
if STATEMENT:
|
| 117 |
+
if st.sidebar.button('TTS'):
|
| 118 |
+
# Call your Summarize function here
|
| 119 |
+
#st.write('\n\n')
|
| 120 |
+
|
| 121 |
+
# Text to generate speech from
|
| 122 |
+
text = "This is a sample text to be converted to speech."
|
| 123 |
+
|
| 124 |
+
# Generate speech
|
| 125 |
+
speech = tts(text)
|
| 126 |
+
|
| 127 |
+
# Save the audio file
|
| 128 |
+
speech.save("sample_tts.wav")
|
| 129 |
+
|
| 130 |
+
st.sidebar.write('Text converted to speech')
|
| 131 |
+
#summarize_statement(STATEMENT) # Directly pass the STATEMENT
|
| 132 |
+
else:
|
| 133 |
+
st.sidebar.button('TTS', disabled=True)
|
| 134 |
+
#st.warning('π Please enter Statement!')
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
|
| 138 |
################ STATEMENT SUMMARIZATION - side bar - pipeline #################
|
| 139 |
|
| 140 |
# Load the summarization model
|
|
|
|
| 157 |
else:
|
| 158 |
st.sidebar.button('Summarize Statement2', disabled=True)
|
| 159 |
#st.warning('π Please enter Statement!')
|
|
|
|
| 160 |
|
| 161 |
+
|
| 162 |
|
| 163 |
# ################ CHAT BOT - main area #################
|
| 164 |
|