Walterchamy commited on
Commit
7722289
1 Parent(s): 0001a00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -89,14 +89,7 @@ def generate_response(user_input):
89
  )
90
  return response['choices'][0]['message']['content']
91
 
92
- def main():
93
- st.title("KIITEC VIRTUAL ASSISTANT")
94
- user_input = st.text_input("Enter your question:")
95
- if st.button("Generate"):
96
- with st.spinner("Generating Response...."):
97
- response_text = generate_response(user_input)
98
- st.write("Response:", response_text)
99
-
100
  def text_to_speech(text):
101
  # Create a text-to-speech object
102
  tts = gTTS(text=text, lang=('en','sw'))
@@ -105,8 +98,15 @@ def text_to_speech(text):
105
 
106
  # Play the audio file
107
  st.audio("output.mp3")
108
- text_to_speech(response_text)
109
 
110
- if __name__ == '__main__':
111
- main()
 
 
 
 
 
 
112
 
 
 
 
89
  )
90
  return response['choices'][0]['message']['content']
91
 
92
+
 
 
 
 
 
 
 
93
  def text_to_speech(text):
94
  # Create a text-to-speech object
95
  tts = gTTS(text=text, lang=('en','sw'))
 
98
 
99
  # Play the audio file
100
  st.audio("output.mp3")
 
101
 
102
+ def main():
103
+ st.title("KIITEC VIRTUAL ASSISTANT")
104
+ user_input = st.text_input("Enter your question:")
105
+ if st.button("Generate"):
106
+ with st.spinner("Generating Response...."):
107
+ response_text = generate_response(user_input)
108
+ st.write("Response:", response_text)
109
+ text_to_speech(response_text)
110
 
111
+ if __name__ == '__main__':
112
+ main()