mgokg commited on
Commit
e6bff66
·
verified ·
1 Parent(s): e9198d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -128,13 +128,17 @@ def save_to_csv(data, filename):
128
  def clear():
129
  return "", ""
130
 
 
 
 
 
131
  # Create the Gradio interface
132
  with gr.Blocks() as demo:
133
  gr.Markdown("[![Download](https://specialist-it.de/downloadbut.png)](https://specialist-it.de/verein.csv)")
134
  with gr.Row():
135
  ort_input = gr.Textbox(label="Ort", placeholder="Gib den Namen des Ortes ein")
136
  with gr.Row():
137
- details_output = gr.Textbox(label="Vereinsliste")
138
 
139
  def process_ort(ort):
140
  links_text, links = parse_links_and_content(ort)
@@ -161,8 +165,19 @@ with gr.Blocks() as demo:
161
  json_data = json_data.replace("```json","")
162
  json_data = json_data.replace("```","")
163
  json_data = gr.JSON(json_data)
 
 
 
 
 
 
 
164
  return json_data
165
 
 
 
 
 
166
  with gr.Row():
167
  clearbutton = gr.Button("Clear")
168
  button = gr.Button("Senden")
 
128
  def clear():
129
  return "", ""
130
 
131
+ def load_data():
132
+ return df
133
+
134
+
135
  # Create the Gradio interface
136
  with gr.Blocks() as demo:
137
  gr.Markdown("[![Download](https://specialist-it.de/downloadbut.png)](https://specialist-it.de/verein.csv)")
138
  with gr.Row():
139
  ort_input = gr.Textbox(label="Ort", placeholder="Gib den Namen des Ortes ein")
140
  with gr.Row():
141
+ details_output = gr.Dataframe(value=load_data())
142
 
143
  def process_ort(ort):
144
  links_text, links = parse_links_and_content(ort)
 
165
  json_data = json_data.replace("```json","")
166
  json_data = json_data.replace("```","")
167
  json_data = gr.JSON(json_data)
168
+
169
+ # JSON-Daten in ein DataFrame laden
170
+ df = pd.read_json(json_data)
171
+
172
+ # DataFrame in eine CSV-Datei konvertieren
173
+ #df.to_csv('daten.csv', index=False)
174
+
175
  return json_data
176
 
177
+
178
+
179
+
180
+
181
  with gr.Row():
182
  clearbutton = gr.Button("Clear")
183
  button = gr.Button("Senden")