rakeshkumar1812 commited on
Commit
a48fb15
1 Parent(s): 4436bbf

layout updated wide to centered

Browse files
Files changed (1) hide show
  1. app.py +66 -66
app.py CHANGED
@@ -1,67 +1,67 @@
1
- import streamlit as st
2
- import utils
3
-
4
-
5
- # https://github.com/serkanyasr/RAG-with-LangChain-URL-PDF/blob/main/utils.py
6
-
7
-
8
- st.set_page_config(layout="wide")
9
- st.markdown("<h1 style='font-size:24px;'>RAG with LangChain & GenAI: Any url</h1>", unsafe_allow_html=True)
10
- # st.title("RAG with LangChain & GenAI: Any url")
11
-
12
- # URL text box for user input
13
- url_input = st.text_input("Enter a URL to be queried:", "")
14
-
15
- # Input text box for user input
16
- user_input = st.text_input("Enter your Question below:", "")
17
-
18
- # Display the user input
19
- # st.write("You entered:", user_input)
20
- # st.write("URL entered:", url_input)
21
- sumbit_btn = st.button(label="Submit",key="url_btn")
22
-
23
- if sumbit_btn:
24
- with st.spinner("Processing..."):
25
- st.success("Response: Answering with RAG...")
26
- response = utils.rag_with_url(url_input,user_input)
27
- st.markdown(response)
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
- # st.title("Retrieval-Augmented Generation (RAG) with LangChain : PDF ")
37
- # st.divider()
38
-
39
- # col_input , col_rag , col_normal = st.columns([3,5,5])
40
- # with col_input:
41
- # selected_file = st.file_uploader("PDF File", type=["pdf"])
42
- # st.divider()
43
- # prompt = st.text_input("Prompt",key="pdf_prompt")
44
- # st.divider()
45
- # sumbit_btn = st.button(label="Submit",key="pdf_btn")
46
-
47
- # if sumbit_btn:
48
- # with col_rag:
49
- # with st.spinner("Processing..."):
50
- # st.success("Response: Answering with RAG...")
51
- # response,relevant_documents = utils.rag_with_pdf(file_path=f"./data/{selected_file.name}",
52
- # prompt=prompt)
53
- # st.markdown(response)
54
- # st.divider()
55
- # st.info("Documents")
56
- # for doc in relevant_documents:
57
- # st.caption(doc.page_content)
58
- # st.markdown(f"Source: {doc.metadata}")
59
- # st.divider()
60
-
61
- # with col_normal:
62
- # with st.spinner("Processing..."):
63
- # st.info("Response: Answering without RAG...")
64
- # response = utils.ask_gemini(prompt)
65
- # st.markdown(response)
66
- # st.divider()
67
 
 
1
+ import streamlit as st
2
+ import utils
3
+
4
+
5
+ # https://github.com/serkanyasr/RAG-with-LangChain-URL-PDF/blob/main/utils.py
6
+
7
+
8
+ st.set_page_config(layout="centered")
9
+ st.markdown("<h1 style='font-size:24px;'>RAG with LangChain & GenAI: Any url</h1>", unsafe_allow_html=True)
10
+ # st.title("RAG with LangChain & GenAI: Any url")
11
+
12
+ # URL text box for user input
13
+ url_input = st.text_input("Enter a URL to be queried:", "")
14
+
15
+ # Input text box for user input
16
+ user_input = st.text_input("Enter your Question below:", "")
17
+
18
+ # Display the user input
19
+ # st.write("You entered:", user_input)
20
+ # st.write("URL entered:", url_input)
21
+ sumbit_btn = st.button(label="Submit",key="url_btn")
22
+
23
+ if sumbit_btn:
24
+ with st.spinner("Processing..."):
25
+ st.success("Response: Answering with RAG...")
26
+ response = utils.rag_with_url(url_input,user_input)
27
+ st.markdown(response)
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+ # st.title("Retrieval-Augmented Generation (RAG) with LangChain : PDF ")
37
+ # st.divider()
38
+
39
+ # col_input , col_rag , col_normal = st.columns([3,5,5])
40
+ # with col_input:
41
+ # selected_file = st.file_uploader("PDF File", type=["pdf"])
42
+ # st.divider()
43
+ # prompt = st.text_input("Prompt",key="pdf_prompt")
44
+ # st.divider()
45
+ # sumbit_btn = st.button(label="Submit",key="pdf_btn")
46
+
47
+ # if sumbit_btn:
48
+ # with col_rag:
49
+ # with st.spinner("Processing..."):
50
+ # st.success("Response: Answering with RAG...")
51
+ # response,relevant_documents = utils.rag_with_pdf(file_path=f"./data/{selected_file.name}",
52
+ # prompt=prompt)
53
+ # st.markdown(response)
54
+ # st.divider()
55
+ # st.info("Documents")
56
+ # for doc in relevant_documents:
57
+ # st.caption(doc.page_content)
58
+ # st.markdown(f"Source: {doc.metadata}")
59
+ # st.divider()
60
+
61
+ # with col_normal:
62
+ # with st.spinner("Processing..."):
63
+ # st.info("Response: Answering without RAG...")
64
+ # response = utils.ask_gemini(prompt)
65
+ # st.markdown(response)
66
+ # st.divider()
67