Spaces:
Sleeping
Sleeping
Update QA_Bot.py
Browse files
QA_Bot.py
CHANGED
@@ -1,11 +1,14 @@
|
|
1 |
import streamlit as st
|
2 |
from QnA import Q_A
|
3 |
import re,time
|
4 |
-
from QnA import get_hugging_face_model , summarize
|
5 |
|
6 |
|
7 |
-
def summarize_data(documents):
|
8 |
-
|
|
|
|
|
|
|
9 |
summary = summarize(documents,llm)
|
10 |
return summary
|
11 |
|
@@ -21,7 +24,7 @@ def QA_Bot(vectorstore,API_KEY,documents):
|
|
21 |
for message in st.session_state.messages:
|
22 |
with st.chat_message(message["role"]):
|
23 |
st.markdown(message["content"])
|
24 |
-
summary_response = summarize_data(documents)
|
25 |
print(summary_response)
|
26 |
|
27 |
# React to user input
|
|
|
1 |
import streamlit as st
|
2 |
from QnA import Q_A
|
3 |
import re,time
|
4 |
+
from QnA import get_hugging_face_model , summarize ,get_groq_model
|
5 |
|
6 |
|
7 |
+
def summarize_data(documents,api_key):
|
8 |
+
if api_key.startswith('gsk'):
|
9 |
+
llm = get_groq_model(api_key)
|
10 |
+
else:
|
11 |
+
llm= get_hugging_face_model(api_key=api_key)
|
12 |
summary = summarize(documents,llm)
|
13 |
return summary
|
14 |
|
|
|
24 |
for message in st.session_state.messages:
|
25 |
with st.chat_message(message["role"]):
|
26 |
st.markdown(message["content"])
|
27 |
+
summary_response = summarize_data(documents,API_KEY)
|
28 |
print(summary_response)
|
29 |
|
30 |
# React to user input
|