File size: 485 Bytes
9f12435
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import re
import streamlit as st
from PyBingScrapper.search import BingSearch

query = st.text_input("Enter the query you want to search for:,{PS: please enter the search term in brackets []}")
submit_button = st.button("Submit")
r = "\[(.*?)\]"
re_list = re.findall(r, query)
q_input = (' ').join(re_list)

if submit_button:
    bingsearch = BingSearch(q_input)
    b_res = bingsearch.get_results(num=5, max_lines=3)
    st.info(bingsearch.rag_output(query, b_res, hf_token, 15))