Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -91,10 +91,10 @@ def main():
|
|
| 91 |
#text = read_documents_from_directory(train_directory)
|
| 92 |
|
| 93 |
def get_pdf_links_from_dataset(url):
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
|
| 99 |
dataset_url = 'https://huggingface.co/datasets/Writo/realestate_data/tree/main'
|
| 100 |
pdf_links = get_pdf_links_from_dataset(dataset_url)
|
|
|
|
| 91 |
#text = read_documents_from_directory(train_directory)
|
| 92 |
|
| 93 |
def get_pdf_links_from_dataset(url):
|
| 94 |
+
response = requests.get(url)
|
| 95 |
+
soup = BeautifulSoup(response.text, 'html.parser')
|
| 96 |
+
pdf_links = [link.get('href') for link in soup.find_all('a') if link.get('href').endswith('.pdf')]
|
| 97 |
+
return pdf_links
|
| 98 |
|
| 99 |
dataset_url = 'https://huggingface.co/datasets/Writo/realestate_data/tree/main'
|
| 100 |
pdf_links = get_pdf_links_from_dataset(dataset_url)
|