AamirMalik commited on
Commit
19b7a1f
·
verified ·
1 Parent(s): daed239

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,9 +1,9 @@
1
  import streamlit as st
2
- from scraping_utils import search_web
3
 
4
  # Streamlit app
5
  st.title("Electronics Component Chatbot")
6
- st.write("Search for electronics components across the web!")
7
 
8
  # Initialize chat history
9
  if "messages" not in st.session_state:
@@ -23,13 +23,13 @@ if prompt := st.chat_input("What component are you looking for?"):
23
 
24
  # Perform web search
25
  try:
26
- search_results = search_web(prompt)
27
  if not search_results:
28
  response = "Sorry, no results were found for your query. Please try again with a different keyword."
29
  else:
30
  response = "### Search Results:\n"
31
  for result in search_results[:5]: # Show top 5 results
32
- response += f"- **[{result['title']}]({result['link']})**\n {result['description']}\n\n"
33
 
34
  except Exception as e:
35
  response = f"An error occurred during the search: {str(e)}"
 
1
  import streamlit as st
2
+ from scraping_utils import search_bing
3
 
4
  # Streamlit app
5
  st.title("Electronics Component Chatbot")
6
+ st.write("Search for electronics components using Bing Search API!")
7
 
8
  # Initialize chat history
9
  if "messages" not in st.session_state:
 
23
 
24
  # Perform web search
25
  try:
26
+ search_results = search_bing(prompt)
27
  if not search_results:
28
  response = "Sorry, no results were found for your query. Please try again with a different keyword."
29
  else:
30
  response = "### Search Results:\n"
31
  for result in search_results[:5]: # Show top 5 results
32
+ response += f"- **[{result['title']}]({result['link']})**\n {result['snippet']}\n\n"
33
 
34
  except Exception as e:
35
  response = f"An error occurred during the search: {str(e)}"