Spaces:
Sleeping
Sleeping
DrishtiSharma
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -168,14 +168,19 @@ def setup_retrieval_pipeline(file_path, persist_dir, api_key):
|
|
168 |
|
169 |
return retrieval_chain
|
170 |
|
|
|
|
|
|
|
|
|
|
|
171 |
if __name__ == "__main__":
|
172 |
st.set_page_config(
|
173 |
page_title="Patent Chat: Google Patents Chat Demo",
|
174 |
-
page_icon="
|
175 |
layout="wide",
|
176 |
initial_sidebar_state="expanded",
|
177 |
)
|
178 |
-
st.header("Patent Chat: Google Patents Chat Demo")
|
179 |
|
180 |
# Input for Google Patent Link
|
181 |
patent_link = st.text_area(
|
@@ -206,7 +211,7 @@ if __name__ == "__main__":
|
|
206 |
# File handling
|
207 |
pdf_path = os.path.join(tempfile.gettempdir(), f"{patent_number}.pdf")
|
208 |
if not os.path.isfile(pdf_path):
|
209 |
-
with st.spinner("Downloading patent file..."):
|
210 |
try:
|
211 |
pdf_path = download_pdf(patent_number)
|
212 |
st.write(f"\u2705 File downloaded: {pdf_path}")
|
|
|
168 |
|
169 |
return retrieval_chain
|
170 |
|
171 |
+
def extract_patent_number(url):
|
172 |
+
pattern = r"/patent/([A-Z]{2}\d+)"
|
173 |
+
match = re.search(pattern, url)
|
174 |
+
return match.group(1) if match else None
|
175 |
+
|
176 |
if __name__ == "__main__":
|
177 |
st.set_page_config(
|
178 |
page_title="Patent Chat: Google Patents Chat Demo",
|
179 |
+
page_icon="",
|
180 |
layout="wide",
|
181 |
initial_sidebar_state="expanded",
|
182 |
)
|
183 |
+
st.header(" Patent Chat: Google Patents Chat Demo")
|
184 |
|
185 |
# Input for Google Patent Link
|
186 |
patent_link = st.text_area(
|
|
|
211 |
# File handling
|
212 |
pdf_path = os.path.join(tempfile.gettempdir(), f"{patent_number}.pdf")
|
213 |
if not os.path.isfile(pdf_path):
|
214 |
+
with st.spinner(" Downloading patent file..."):
|
215 |
try:
|
216 |
pdf_path = download_pdf(patent_number)
|
217 |
st.write(f"\u2705 File downloaded: {pdf_path}")
|