Final app ready in app.py
Browse files- requirements.txt +2 -3
- trialapp.py +8 -6
requirements.txt
CHANGED
@@ -1,14 +1,13 @@
|
|
1 |
ipykernel
|
2 |
streamlit
|
3 |
faiss-cpu
|
|
|
4 |
langchain
|
5 |
-
langchain_huggingface
|
6 |
langchain_groq
|
7 |
gradio
|
8 |
-
typing-extensions
|
9 |
python-dotenv
|
10 |
langchain_community
|
11 |
pypdf
|
12 |
pymupdf
|
13 |
langchain-text-splitters
|
14 |
-
langchain_huggingface
|
|
|
1 |
ipykernel
|
2 |
streamlit
|
3 |
faiss-cpu
|
4 |
+
typing_extensions
|
5 |
langchain
|
|
|
6 |
langchain_groq
|
7 |
gradio
|
|
|
8 |
python-dotenv
|
9 |
langchain_community
|
10 |
pypdf
|
11 |
pymupdf
|
12 |
langchain-text-splitters
|
13 |
+
langchain_huggingface
|
trialapp.py
CHANGED
@@ -24,7 +24,8 @@ os.environ['GROQ_API_KEY'] = os.getenv('GROQ_API_KEY')
|
|
24 |
embeddings = HuggingFaceEmbeddings(model_name="all-MiniLM-L6-v2")
|
25 |
|
26 |
# Streamlit app
|
27 |
-
st.title("
|
|
|
28 |
st.write("Upload PDFs and ask questions related to the content of the PDFs.")
|
29 |
llm = ChatGroq(model="Gemma2-9b-It")
|
30 |
session_id = st.text_input("Session ID", value="common_session")
|
@@ -32,10 +33,10 @@ session_id = st.text_input("Session ID", value="common_session")
|
|
32 |
# Manage chat history
|
33 |
if 'store' not in st.session_state:
|
34 |
st.session_state.store = {}
|
35 |
-
|
36 |
# Upload files and document loading
|
37 |
uploaded_files = st.file_uploader("Drop the PDF files here", type="pdf", accept_multiple_files=True)
|
38 |
-
|
39 |
if uploaded_files:
|
40 |
documents = []
|
41 |
for uploaded_file in uploaded_files:
|
@@ -115,6 +116,8 @@ if uploaded_files:
|
|
115 |
},
|
116 |
)
|
117 |
|
|
|
|
|
118 |
# Display the chat history
|
119 |
st.write("### Chat History")
|
120 |
for message in session_history.messages:
|
@@ -128,12 +131,11 @@ if uploaded_files:
|
|
128 |
|
129 |
if role == "user":
|
130 |
with st.chat_message("user"):
|
131 |
-
st.
|
132 |
elif role == "assistant":
|
133 |
with st.chat_message("assistant"):
|
134 |
-
st.
|
135 |
elif role == "system":
|
136 |
with st.chat_message("system"):
|
137 |
st.markdown(f"**System Message:** {content}")
|
138 |
-
|
139 |
#st.write("Assistant:", response['answer'])
|
|
|
24 |
embeddings = HuggingFaceEmbeddings(model_name="all-MiniLM-L6-v2")
|
25 |
|
26 |
# Streamlit app
|
27 |
+
st.title("π―π£π₯π²πΎπππΎ : π―π£π₯ π°ππΎπππππ πΊππ½ π ππππΎππππ ππππ π²πΎπππππ π’ππΊπ π§ππππππ")
|
28 |
+
st.markdown('####')
|
29 |
st.write("Upload PDFs and ask questions related to the content of the PDFs.")
|
30 |
llm = ChatGroq(model="Gemma2-9b-It")
|
31 |
session_id = st.text_input("Session ID", value="common_session")
|
|
|
33 |
# Manage chat history
|
34 |
if 'store' not in st.session_state:
|
35 |
st.session_state.store = {}
|
36 |
+
st.markdown('####')
|
37 |
# Upload files and document loading
|
38 |
uploaded_files = st.file_uploader("Drop the PDF files here", type="pdf", accept_multiple_files=True)
|
39 |
+
st.markdown('####')
|
40 |
if uploaded_files:
|
41 |
documents = []
|
42 |
for uploaded_file in uploaded_files:
|
|
|
116 |
},
|
117 |
)
|
118 |
|
119 |
+
st.write("### Response")
|
120 |
+
st.success(response['answer'])
|
121 |
# Display the chat history
|
122 |
st.write("### Chat History")
|
123 |
for message in session_history.messages:
|
|
|
131 |
|
132 |
if role == "user":
|
133 |
with st.chat_message("user"):
|
134 |
+
st.success(content)
|
135 |
elif role == "assistant":
|
136 |
with st.chat_message("assistant"):
|
137 |
+
st.success(content)
|
138 |
elif role == "system":
|
139 |
with st.chat_message("system"):
|
140 |
st.markdown(f"**System Message:** {content}")
|
|
|
141 |
#st.write("Assistant:", response['answer'])
|