Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import gradio as gr
|
|
| 2 |
import requests
|
| 3 |
from bs4 import BeautifulSoup
|
| 4 |
from urllib.parse import urljoin
|
|
|
|
| 5 |
|
| 6 |
def parse_links_and_content(ort):
|
| 7 |
base_url = "https://vereine-in-deutschland.net"
|
|
@@ -47,8 +48,6 @@ def parse_links_and_content(ort):
|
|
| 47 |
all_links.extend(texts)
|
| 48 |
else:
|
| 49 |
print(f"Target div not found on page {page_number}")
|
| 50 |
-
|
| 51 |
-
#all_links = {key: value for key, value in data.items() if value != ort}
|
| 52 |
|
| 53 |
except Exception as e:
|
| 54 |
return str(e), []
|
|
@@ -58,6 +57,15 @@ def parse_links_and_content(ort):
|
|
| 58 |
#return filtered_data
|
| 59 |
|
| 60 |
def scrape_links(links):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
results = []
|
| 62 |
for link in links:
|
| 63 |
try:
|
|
|
|
| 2 |
import requests
|
| 3 |
from bs4 import BeautifulSoup
|
| 4 |
from urllib.parse import urljoin
|
| 5 |
+
from gradio_client import Client
|
| 6 |
|
| 7 |
def parse_links_and_content(ort):
|
| 8 |
base_url = "https://vereine-in-deutschland.net"
|
|
|
|
| 48 |
all_links.extend(texts)
|
| 49 |
else:
|
| 50 |
print(f"Target div not found on page {page_number}")
|
|
|
|
|
|
|
| 51 |
|
| 52 |
except Exception as e:
|
| 53 |
return str(e), []
|
|
|
|
| 57 |
#return filtered_data
|
| 58 |
|
| 59 |
def scrape_links(links):
|
| 60 |
+
|
| 61 |
+
client = Client("mgokg/PerplexicaApi")
|
| 62 |
+
|
| 63 |
+
result = client.predict(
|
| 64 |
+
prompt="contact details Aero Club Bamberg e.v.",
|
| 65 |
+
api_name="/parse_links"
|
| 66 |
+
)
|
| 67 |
+
print(result)
|
| 68 |
+
return result
|
| 69 |
results = []
|
| 70 |
for link in links:
|
| 71 |
try:
|