Munwar92 commited on
Commit
c676825
·
verified ·
1 Parent(s): e98c9e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -76,13 +76,17 @@ def main():
76
  if mode == "Text":
77
  user_input = st.text_input("Ask me anything:")
78
  if user_input:
79
- url = "https://www.sbbusba.edu.pk/" # Example URL, can be dynamically set by the user
80
- web_content = scrape_website(url)
81
- relevant_data = search(user_input, [web_content])
82
-
83
- response = generate_response(f"Based on the content of the website: {relevant_data[0]}")
84
- st.write("Bot: " + response)
85
- text_to_speech(response) # Convert the text response to speech
 
 
 
 
86
 
87
  elif mode == "Voice":
88
  if st.button("Start Listening"):
 
76
  if mode == "Text":
77
  user_input = st.text_input("Ask me anything:")
78
  if user_input:
79
+ url = "https://www.sbbusba.edu.pk/" # Example URL
80
+ web_content = scrape_website(url)
81
+ relevant_data = search(user_input, [web_content])
82
+
83
+ if relevant_data and isinstance(relevant_data[0], str):
84
+ response = generate_response(f"Based on the content of the website: {relevant_data[0]}")
85
+ st.write("Bot: " + response)
86
+ text_to_speech(response)
87
+ else:
88
+ st.write("Bot: Sorry, I couldn't find any relevant data.")
89
+
90
 
91
  elif mode == "Voice":
92
  if st.button("Start Listening"):