Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -126,22 +126,22 @@ with gr.Blocks() as demo:
|
|
| 126 |
ort_input = gr.Textbox(label="Ort", placeholder="Gib den Namen des Ortes ein")
|
| 127 |
with gr.Row():
|
| 128 |
details_output = gr.JSON(label="Kontaktinformation")
|
| 129 |
-
links_output = gr.JSON(label="Vereinsliste")
|
| 130 |
|
| 131 |
def process_ort(ort):
|
| 132 |
links_text, links = parse_links_and_content(ort)
|
| 133 |
contact_details = scrape_links(links)
|
| 134 |
json_data = [json.loads(detail) for detail in contact_details if detail.startswith("{")]
|
| 135 |
save_to_csv(json_data, './contact_details.csv')
|
| 136 |
-
return
|
| 137 |
|
| 138 |
with gr.Row():
|
| 139 |
clearbutton = gr.Button("Clear")
|
| 140 |
button = gr.Button("Senden")
|
| 141 |
|
| 142 |
# Connect the button to the function
|
| 143 |
-
button.click(fn=process_ort, inputs=ort_input, outputs=
|
| 144 |
-
clearbutton.click(fn=clear, inputs=[], outputs=
|
| 145 |
|
| 146 |
# Launch the Gradio application
|
| 147 |
demo.launch()
|
|
|
|
| 126 |
ort_input = gr.Textbox(label="Ort", placeholder="Gib den Namen des Ortes ein")
|
| 127 |
with gr.Row():
|
| 128 |
details_output = gr.JSON(label="Kontaktinformation")
|
| 129 |
+
#links_output = gr.JSON(label="Vereinsliste")
|
| 130 |
|
| 131 |
def process_ort(ort):
|
| 132 |
links_text, links = parse_links_and_content(ort)
|
| 133 |
contact_details = scrape_links(links)
|
| 134 |
json_data = [json.loads(detail) for detail in contact_details if detail.startswith("{")]
|
| 135 |
save_to_csv(json_data, './contact_details.csv')
|
| 136 |
+
return contact_details
|
| 137 |
|
| 138 |
with gr.Row():
|
| 139 |
clearbutton = gr.Button("Clear")
|
| 140 |
button = gr.Button("Senden")
|
| 141 |
|
| 142 |
# Connect the button to the function
|
| 143 |
+
button.click(fn=process_ort, inputs=ort_input, outputs=details_output)
|
| 144 |
+
clearbutton.click(fn=clear, inputs=[], outputs=details_output)
|
| 145 |
|
| 146 |
# Launch the Gradio application
|
| 147 |
demo.launch()
|