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