Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,26 +86,26 @@ with gr.Blocks() as demo:
|
|
| 86 |
with gr.Row():
|
| 87 |
ort_input = gr.Textbox(label="Ort", placeholder="Gib den Namen des Ortes ein")
|
| 88 |
#links_output = gr.Textbox(label="Vereinsliste")
|
| 89 |
-
|
| 90 |
-
json_output = gr.JSON(label="Ergebnisse")
|
| 91 |
|
| 92 |
def process_ort(ort):
|
| 93 |
links = parse_links_and_content(ort)
|
| 94 |
-
return links
|
| 95 |
contact= scrape_links(links)
|
| 96 |
json_data = [json.loads(item) for item in contact]
|
| 97 |
#save_to_csv(json_data, './contact_details.csv')
|
| 98 |
#return f"[Download CSV](contact_details.csv)", json_data
|
| 99 |
-
return json_data
|
| 100 |
#return contact
|
| 101 |
-
|
| 102 |
#return json_data
|
| 103 |
|
| 104 |
# Button zum Starten der Parsung
|
| 105 |
button = gr.Button("senden")
|
| 106 |
|
| 107 |
# Verbinde den Button mit der Funktion
|
| 108 |
-
button.click(fn=process_ort, inputs=ort_input, outputs=
|
| 109 |
|
| 110 |
# Starte die Gradio-Anwendung
|
| 111 |
demo.launch()
|
|
|
|
| 86 |
with gr.Row():
|
| 87 |
ort_input = gr.Textbox(label="Ort", placeholder="Gib den Namen des Ortes ein")
|
| 88 |
#links_output = gr.Textbox(label="Vereinsliste")
|
| 89 |
+
links_output = gr.DataFrame(label="Ergebnisse")
|
| 90 |
+
#json_output = gr.JSON(label="Ergebnisse")
|
| 91 |
|
| 92 |
def process_ort(ort):
|
| 93 |
links = parse_links_and_content(ort)
|
| 94 |
+
#return links
|
| 95 |
contact= scrape_links(links)
|
| 96 |
json_data = [json.loads(item) for item in contact]
|
| 97 |
#save_to_csv(json_data, './contact_details.csv')
|
| 98 |
#return f"[Download CSV](contact_details.csv)", json_data
|
| 99 |
+
#return json_data
|
| 100 |
#return contact
|
| 101 |
+
return pd.DataFrame(json_data)
|
| 102 |
#return json_data
|
| 103 |
|
| 104 |
# Button zum Starten der Parsung
|
| 105 |
button = gr.Button("senden")
|
| 106 |
|
| 107 |
# Verbinde den Button mit der Funktion
|
| 108 |
+
button.click(fn=process_ort, inputs=ort_input, outputs=links_output)
|
| 109 |
|
| 110 |
# Starte die Gradio-Anwendung
|
| 111 |
demo.launch()
|