Spaces:
Sleeping
Sleeping
Commit
·
33e17d9
1
Parent(s):
eb11c64
simplify interface
Browse files- .gitignore +1 -0
- app.py +4 -15
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
__pycache__
|
app.py
CHANGED
@@ -188,19 +188,13 @@ with gr.Blocks() as app:
|
|
188 |
with gr.Row():
|
189 |
name_input = gr.Textbox(label="Name")
|
190 |
date_input = Calendar(label="Date", type="date")
|
191 |
-
with gr.Row():
|
192 |
-
date_language_input = gr.Dropdown(
|
193 |
-
choices=list(LANGUAGE_CODE_MAP.keys()),
|
194 |
-
label="Language (Date Words)",
|
195 |
-
value='english',
|
196 |
-
)
|
197 |
with gr.Row():
|
198 |
run_button = gr.Button("Find Psalm")
|
199 |
with gr.Row():
|
200 |
iframe_output = gr.HTML(label="Psalm Display")
|
201 |
|
202 |
-
def main_function(name, date
|
203 |
-
logger.debug(f"Entering main_function with name: '{name}', date: '{date}'
|
204 |
|
205 |
if not name or not date:
|
206 |
logger.debug("Name or date missing. Returning error message.")
|
@@ -214,13 +208,8 @@ with gr.Blocks() as app:
|
|
214 |
date_words = date_to_words(date_str)
|
215 |
logger.debug(f"Date words: {date_words}")
|
216 |
|
217 |
-
translator = GoogleTranslator(source='auto', target=date_language_input)
|
218 |
-
translated_date_words = translator.translate(date_words)
|
219 |
-
logger.debug(f"Translated date words (raw): {translated_date_words}")
|
220 |
-
translated_date_words = custom_normalize(translated_date_words)
|
221 |
-
logger.debug(f"Translated date words (normalized): {translated_date_words}")
|
222 |
|
223 |
-
initial_gematria_sum = calculate_gematria_sum(name,
|
224 |
logger.debug(f"Initial Gematria Sum: {initial_gematria_sum}")
|
225 |
|
226 |
if initial_gematria_sum is None:
|
@@ -249,7 +238,7 @@ with gr.Blocks() as app:
|
|
249 |
|
250 |
run_button.click(
|
251 |
main_function,
|
252 |
-
inputs=[name_input, date_input
|
253 |
outputs=[iframe_output]
|
254 |
)
|
255 |
|
|
|
188 |
with gr.Row():
|
189 |
name_input = gr.Textbox(label="Name")
|
190 |
date_input = Calendar(label="Date", type="date")
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
with gr.Row():
|
192 |
run_button = gr.Button("Find Psalm")
|
193 |
with gr.Row():
|
194 |
iframe_output = gr.HTML(label="Psalm Display")
|
195 |
|
196 |
+
def main_function(name, date):
|
197 |
+
logger.debug(f"Entering main_function with name: '{name}', date: '{date}'")
|
198 |
|
199 |
if not name or not date:
|
200 |
logger.debug("Name or date missing. Returning error message.")
|
|
|
208 |
date_words = date_to_words(date_str)
|
209 |
logger.debug(f"Date words: {date_words}")
|
210 |
|
|
|
|
|
|
|
|
|
|
|
211 |
|
212 |
+
initial_gematria_sum = calculate_gematria_sum(name, date_words)
|
213 |
logger.debug(f"Initial Gematria Sum: {initial_gematria_sum}")
|
214 |
|
215 |
if initial_gematria_sum is None:
|
|
|
238 |
|
239 |
run_button.click(
|
240 |
main_function,
|
241 |
+
inputs=[name_input, date_input],
|
242 |
outputs=[iframe_output]
|
243 |
)
|
244 |
|