Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -20,9 +20,9 @@ llm = ChatGoogleGenerativeAI(model="gemini-pro",
|
|
20 |
|
21 |
|
22 |
|
23 |
-
template = """You are "CRETA," a friendly chatbot developed by Suriya, an AI enthusiast.
|
24 |
|
25 |
-
|
26 |
{extracted_text}
|
27 |
|
28 |
Provided document:
|
@@ -56,10 +56,14 @@ def conversational_chat(query):
|
|
56 |
for j in st.session_state["docs"]:
|
57 |
if j is not None:
|
58 |
docs += j
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
61 |
provided_docs = docs
|
62 |
-
result = llm_chain.predict(chat_history=previous_response, human_input=query, provided_docs=provided_docs,extracted_text=
|
63 |
st.session_state['history'].append((query, result))
|
64 |
return result
|
65 |
|
@@ -81,7 +85,7 @@ if 'docs' not in st.session_state:
|
|
81 |
st.session_state['docs'] = []
|
82 |
|
83 |
if "extracted_text" not in st.session_state:
|
84 |
-
st.session_state["extracted_text"] =
|
85 |
|
86 |
def get_pdf_text(pdf_docs):
|
87 |
text = ""
|
|
|
20 |
|
21 |
|
22 |
|
23 |
+
template = """You are "CRETA," a friendly chatbot developed by Suriya, an AI enthusiast and if user ask about the given url or provied url query answer from the Extracted Text URL.
|
24 |
|
25 |
+
Extracted Text URL:
|
26 |
{extracted_text}
|
27 |
|
28 |
Provided document:
|
|
|
56 |
for j in st.session_state["docs"]:
|
57 |
if j is not None:
|
58 |
docs += j
|
59 |
+
text = ""
|
60 |
+
for k in st.session_state["extracted_text"]:
|
61 |
+
if k is not None:
|
62 |
+
docs += k
|
63 |
+
|
64 |
+
# ex_text = st.session_state["extracted_text"]
|
65 |
provided_docs = docs
|
66 |
+
result = llm_chain.predict(chat_history=previous_response, human_input=query, provided_docs=provided_docs,extracted_text=text)
|
67 |
st.session_state['history'].append((query, result))
|
68 |
return result
|
69 |
|
|
|
85 |
st.session_state['docs'] = []
|
86 |
|
87 |
if "extracted_text" not in st.session_state:
|
88 |
+
st.session_state["extracted_text"] = []
|
89 |
|
90 |
def get_pdf_text(pdf_docs):
|
91 |
text = ""
|