-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
35 lines (27 loc) · 1.08 KB
/
main.py
File metadata and controls
35 lines (27 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import streamlit as st
import pandas as pd
from pipeline import process_text_to_embeddings
st.set_page_config(page_title="📄 RAG Chatbot", layout="wide")
# init state
if "mode" not in st.session_state:
st.session_state.mode = "upload"
if "embed_text" not in st.session_state:
st.session_state.embed_text = None
if st.session_state.mode == "upload":
st.markdown(
"""
Upload your PDF and let our **Retrieval-Augmented Generation (RAG)** model
build an intelligent chatbot that can answer your questions directly from the document.
🔹 No more scrolling through pages
🔹 Just ask, and get answers in seconds
"""
)
store_pdf = st.file_uploader("Upload PDF", type="pdf")
if store_pdf is not None:
with st.spinner("Processing the PDF......... Hang in there!"):
embed_text = process_text_to_embeddings(store_pdf)
st.success("PDF processed successfully!")
if st.button("➡️ Setup ChatBot"):
st.session_state.mode = "app"
elif st.session_state.mode == "app":
st.title("🤖 Chatbot Mode")