Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ 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"
|
9 |
all_links = []
|
@@ -57,15 +59,17 @@ def parse_links_and_content(ort):
|
|
57 |
#return filtered_data
|
58 |
|
59 |
def scrape_links(links):
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
)
|
67 |
-
|
68 |
-
|
|
|
|
|
69 |
|
70 |
# Erstelle die Gradio-Schnittstelle
|
71 |
with gr.Blocks() as demo:
|
@@ -77,8 +81,9 @@ with gr.Blocks() as demo:
|
|
77 |
|
78 |
def process_ort(ort):
|
79 |
links = parse_links_and_content(ort)
|
80 |
-
|
81 |
-
return
|
|
|
82 |
|
83 |
# Button zum Starten der Parsung
|
84 |
button = gr.Button("senden")
|
|
|
4 |
from urllib.parse import urljoin
|
5 |
from gradio_client import Client
|
6 |
|
7 |
+
client = Client("mgokg/PerplexicaApi")
|
8 |
+
|
9 |
def parse_links_and_content(ort):
|
10 |
base_url = "https://vereine-in-deutschland.net"
|
11 |
all_links = []
|
|
|
59 |
#return filtered_data
|
60 |
|
61 |
def scrape_links(links):
|
62 |
+
links=links
|
63 |
+
contact_details= []
|
64 |
+
for verein in links:
|
65 |
+
result = client.predict(
|
66 |
+
prompt=f"{verein}",
|
67 |
+
api_name="/parse_links"
|
68 |
+
)
|
69 |
+
#print(result)
|
70 |
+
contact_details.append(result)
|
71 |
+
|
72 |
+
return contact_details
|
73 |
|
74 |
# Erstelle die Gradio-Schnittstelle
|
75 |
with gr.Blocks() as demo:
|
|
|
81 |
|
82 |
def process_ort(ort):
|
83 |
links = parse_links_and_content(ort)
|
84 |
+
contact= scrape_links(links)
|
85 |
+
return contact
|
86 |
+
#return links
|
87 |
|
88 |
# Button zum Starten der Parsung
|
89 |
button = gr.Button("senden")
|