Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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"):
|