File size: 807 Bytes
9f12435 023adc5 9f12435 8ae5128 9f12435 023adc5 9f12435 c98b2e3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import re
import streamlit as st
from PyBingScrapper.search import BingSearch
st.title("Bing - RAG")
st.subheader('Implementation of RAG over search results bing search', divider='rainbow')
query = st.text_input("Enter the query you want to search for:")
st.caption("Example: Why is there a huge conflict between India and Pakistan?")
submit_button = st.button("Submit")
hf_token = st.secrets["HF_TOKEN"]
if submit_button:
bingsearch = BingSearch(query)
b_res = bingsearch.get_results(num=5, max_lines=3)
with st.spinner("Pipeline for RAG is running"):
text, text_json = bingsearch.rag_output(b_res, hf_token, 15)
st.subheader('Updated prompt with semantics search')
st.info(text_json['question'])
st.subheader("Generated Text")
st.success(text_json['generated-text']) |