neuralworm commited on
Commit
31904e8
·
1 Parent(s): cbe7a3f

initial commit

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -94,9 +94,7 @@ def generate_json_output(results, start_date, end_date):
94
  def download_json(json_data, start_date, end_date):
95
  """Downloads the JSON data to a file."""
96
  filename = f"gematria_results_{start_date.strftime('%Y%m%d')}_{end_date.strftime('%Y%m%d')}.json"
97
- with open(filename, 'w') as f:
98
- f.write(json_data)
99
- return gr.File.update(value=filename, visible=True)
100
 
101
  # --- Main Gradio App ---
102
  with gr.Blocks() as app:
@@ -107,7 +105,7 @@ with gr.Blocks() as app:
107
  calculate_btn = gr.Button("Calculate Gematria for Date Range")
108
  json_output = gr.Textbox(label="JSON Output")
109
  download_btn = gr.Button("Download JSON")
110
- json_file = gr.File(label="Downloaded JSON", visible=False)
111
 
112
  # --- Event Handlers ---
113
  def perform_calculation(start_date, end_date):
 
94
  def download_json(json_data, start_date, end_date):
95
  """Downloads the JSON data to a file."""
96
  filename = f"gematria_results_{start_date.strftime('%Y%m%d')}_{end_date.strftime('%Y%m%d')}.json"
97
+ return (filename, json_data) # Rückgabe von Dateiname und JSON-Daten
 
 
98
 
99
  # --- Main Gradio App ---
100
  with gr.Blocks() as app:
 
105
  calculate_btn = gr.Button("Calculate Gematria for Date Range")
106
  json_output = gr.Textbox(label="JSON Output")
107
  download_btn = gr.Button("Download JSON")
108
+ json_file = gr.File(label="Downloaded JSON") # Entferne visible=False
109
 
110
  # --- Event Handlers ---
111
  def perform_calculation(start_date, end_date):