neuralworm commited on
Commit
1b969ef
·
1 Parent(s): a676448

initial commit

Browse files
Files changed (2) hide show
  1. app.py +9 -15
  2. requirements.txt +1 -0
app.py CHANGED
@@ -17,13 +17,7 @@ def calculate_gematria_sum(text):
17
  else:
18
  return None
19
 
20
- def perform_gematria_calculation_for_date_range(start_date_str, end_date_str):
21
- logger.info(f"Startdatum (String): {start_date_str}, Enddatum (String): {end_date_str}") # Debugging-Ausgabe
22
-
23
- # Konvertiere die Datumsstrings in datetime-Objekte
24
- start_date = datetime.strptime(start_date_str, "%Y-%m-%d")
25
- end_date = datetime.strptime(end_date_str, "%Y-%m-%d")
26
-
27
  logger.info(f"Startdatum: {start_date}, Enddatum: {end_date}") # Debugging-Ausgabe
28
  results = {}
29
  delta = timedelta(days=1)
@@ -60,25 +54,25 @@ def generate_json_output(results, start_date, end_date):
60
  # --- Main Gradio App ---
61
  with gr.Blocks() as app:
62
  with gr.Row():
63
- start_date = Calendar(type="date", label="Start Date") # Ändere den Typ zu "date"
64
- end_date = Calendar(type="date", label="End Date") # Ändere den Typ zu "date"
65
 
66
  calculate_btn = gr.Button("Calculate Gematria for Date Range")
67
  json_output = gr.Textbox(label="JSON Output")
68
 
69
  # --- Event Handlers ---
70
- def perform_calculation(start_date_str, end_date_str): # Empfange Datumsstrings
71
- logger.info("Berechnung gestartet") # Debugging-Ausgabe
72
- results = perform_gematria_calculation_for_date_range(start_date_str, end_date_str)
73
- json_result = generate_json_output(results, datetime.strptime(start_date_str, "%Y-%m-%d"), datetime.strptime(end_date_str, "%Y-%m-%d"))
74
- logger.info("Berechnung abgeschlossen") # Debugging-Ausgabe
75
  return json_result
76
 
77
  # --- Event Triggers ---
78
  calculate_btn.click(
79
  perform_calculation,
80
  inputs=[start_date, end_date],
81
- outputs=[json_output]
 
82
  )
83
 
84
  if __name__ == "__main__":
 
17
  else:
18
  return None
19
 
20
+ def perform_gematria_calculation_for_date_range(start_date, end_date):
 
 
 
 
 
 
21
  logger.info(f"Startdatum: {start_date}, Enddatum: {end_date}") # Debugging-Ausgabe
22
  results = {}
23
  delta = timedelta(days=1)
 
54
  # --- Main Gradio App ---
55
  with gr.Blocks() as app:
56
  with gr.Row():
57
+ start_date = Calendar(type="datetime", label="Start Date") # Zurück zu "datetime"
58
+ end_date = Calendar(type="datetime", label="End Date") # Zurück zu "datetime"
59
 
60
  calculate_btn = gr.Button("Calculate Gematria for Date Range")
61
  json_output = gr.Textbox(label="JSON Output")
62
 
63
  # --- Event Handlers ---
64
+ def perform_calculation(start_date, end_date): # Empfange datetime-Objekte
65
+ logger.info(f"perform_calculation aufgerufen mit: start_date={start_date}, end_date={end_date}")
66
+ results = perform_gematria_calculation_for_date_range(start_date, end_date)
67
+ json_result = generate_json_output(results, start_date, end_date)
 
68
  return json_result
69
 
70
  # --- Event Triggers ---
71
  calculate_btn.click(
72
  perform_calculation,
73
  inputs=[start_date, end_date],
74
+ outputs=[json_output],
75
+ api_name="calculate_gematria"
76
  )
77
 
78
  if __name__ == "__main__":
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  gradio==4.31.0
2
  gradio_calendar==0.0.4
 
 
1
  gradio==4.31.0
2
  gradio_calendar==0.0.4
3
+ inflect==7.2.1