|
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") |
|
|
|
if submit_button: |
|
bingsearch = BingSearch(query) |
|
b_res = bingsearch.get_results(num=5, max_lines=5) |
|
with st.spinner("Pipeline for RAG is running"): |
|
|
|
hf_token = str(st.secrets["HF_TOKEN"]) |
|
text, text_json = bingsearch.rag_output(b_res, hf_token, n_iters=15) |
|
|
|
st.subheader('Updated prompt with semantics search') |
|
st.info(text_json['question']) |
|
st.subheader("Generated Text") |
|
st.success(text_json['generated-text']) |