Spaces:
Sleeping
Sleeping
DrishtiSharma
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -155,7 +155,7 @@ if __name__ == "__main__":
|
|
155 |
# Fetch query parameters safely
|
156 |
query_params = st.query_params
|
157 |
default_patent_link = query_params.get("patent_link", "https://patents.google.com/patent/US8676427B1/en")
|
158 |
-
|
159 |
# Input for Google Patent Link
|
160 |
patent_link = st.text_area("Enter Google Patent Link:", value=default_patent_link, height=100)
|
161 |
|
@@ -194,13 +194,14 @@ if __name__ == "__main__":
|
|
194 |
# Load the document into the system
|
195 |
st.write("🔄 Loading document into the system...")
|
196 |
|
197 |
-
#
|
198 |
-
if "
|
199 |
st.session_state.chain = load_chain(pdf_path)
|
200 |
-
st.session_state.
|
201 |
st.session_state.messages = [{"role": "assistant", "content": "Hello! How can I assist you with this patent?"}]
|
202 |
-
|
203 |
-
|
|
|
204 |
|
205 |
# Initialize messages if not already done
|
206 |
if "messages" not in st.session_state:
|
|
|
155 |
# Fetch query parameters safely
|
156 |
query_params = st.query_params
|
157 |
default_patent_link = query_params.get("patent_link", "https://patents.google.com/patent/US8676427B1/en")
|
158 |
+
|
159 |
# Input for Google Patent Link
|
160 |
patent_link = st.text_area("Enter Google Patent Link:", value=default_patent_link, height=100)
|
161 |
|
|
|
194 |
# Load the document into the system
|
195 |
st.write("🔄 Loading document into the system...")
|
196 |
|
197 |
+
# Check if the patent is already loaded in session state
|
198 |
+
if "LOADED_PATENT" not in st.session_state or st.session_state.get("LOADED_PATENT") != patent_number:
|
199 |
st.session_state.chain = load_chain(pdf_path)
|
200 |
+
st.session_state.LOADED_PATENT = patent_number # Store the current patent number
|
201 |
st.session_state.messages = [{"role": "assistant", "content": "Hello! How can I assist you with this patent?"}]
|
202 |
+
st.success("🚀 Document successfully loaded! You can now start asking questions.")
|
203 |
+
else:
|
204 |
+
st.success("✅ This patent is already loaded. You can continue asking questions.")
|
205 |
|
206 |
# Initialize messages if not already done
|
207 |
if "messages" not in st.session_state:
|