mgokg commited on
Commit
a68c2e8
·
verified ·
1 Parent(s): 2f3bf94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -42,6 +42,7 @@ def parse_links_and_content(ort):
42
 
43
  if target_div:
44
  links = [urljoin(base_url, a['href']) for a in target_div.find_all('a', href=True)]
 
45
  all_links.extend(links)
46
  else:
47
  print(f"Target div not found on page {page_number}")
@@ -73,22 +74,22 @@ def scrape_links(links):
73
 
74
  # Erstelle die Gradio-Schnittstelle
75
  with gr.Blocks() as demo:
76
- gr.Markdown("# Vereine in Bayern Parser")
77
 
78
  ort_input = gr.Textbox(label="Ort", placeholder="Gib den Namen des Ortes ein")
79
- links_output = gr.JSON(label="Gefundene Links")
80
- content_output = gr.JSON(label="Inhalt der Links")
81
 
82
  def process_ort(ort):
83
  links = parse_links_and_content(ort)
84
- scraped_content = scrape_links(links)
85
- return links, scraped_content
86
 
87
  # Button zum Starten der Parsung
88
  button = gr.Button("Parse und Scrape")
89
 
90
  # Verbinde den Button mit der Funktion
91
- button.click(fn=process_ort, inputs=ort_input, outputs=[links_output, content_output])
92
 
93
  # Starte die Gradio-Anwendung
94
  demo.launch()
 
42
 
43
  if target_div:
44
  links = [urljoin(base_url, a['href']) for a in target_div.find_all('a', href=True)]
45
+ links = links.text
46
  all_links.extend(links)
47
  else:
48
  print(f"Target div not found on page {page_number}")
 
74
 
75
  # Erstelle die Gradio-Schnittstelle
76
  with gr.Blocks() as demo:
77
+ gr.Markdown("# Vereine in Bayern")
78
 
79
  ort_input = gr.Textbox(label="Ort", placeholder="Gib den Namen des Ortes ein")
80
+ links_output = gr.JSON(label="Gefundene Vereine")
81
+ #content_output = gr.JSON(label="Inhalt der Links")
82
 
83
  def process_ort(ort):
84
  links = parse_links_and_content(ort)
85
+ #scraped_content = scrape_links(links)
86
+ return links
87
 
88
  # Button zum Starten der Parsung
89
  button = gr.Button("Parse und Scrape")
90
 
91
  # Verbinde den Button mit der Funktion
92
+ button.click(fn=process_ort, inputs=ort_input, outputs=links_output)
93
 
94
  # Starte die Gradio-Anwendung
95
  demo.launch()