BingRAG / app.py
vishnun's picture
Create app.py
9f12435
raw
history blame
485 Bytes
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))