Spaces:
Sleeping
Sleeping
Commit
·
4db2f42
1
Parent(s):
ddbe479
add search interface
Browse files
app.py
CHANGED
@@ -719,6 +719,8 @@ with gr.Blocks() as app:
|
|
719 |
include_quran_chk_els = gr.Checkbox(label="Include Quran", value=True)
|
720 |
include_hindu_chk_els = gr.Checkbox(label="Include Rigveda", value=False)
|
721 |
include_tripitaka_chk_els = gr.Checkbox(label="Include Tripitaka", value=False)
|
|
|
|
|
722 |
|
723 |
with gr.Row():
|
724 |
perform_search_btn_els = gr.Button("Perform Search")
|
@@ -739,7 +741,7 @@ with gr.Blocks() as app:
|
|
739 |
)
|
740 |
|
741 |
# Hauptfunktion für den vierten Tab
|
742 |
-
def perform_date_range_els_search(start_date, end_date, names_input, search_type, search_term, gematria_sum_search, search_mode, include_torah, include_bible, include_quran, include_hindu, include_tripitaka):
|
743 |
names = [n.strip() for n in names_input.split("\n") if n.strip()]
|
744 |
date_gematrias = perform_gematria_calculation_for_date_range(start_date, end_date)
|
745 |
|
@@ -822,11 +824,22 @@ with gr.Blocks() as app:
|
|
822 |
logger.error(f"KeyError - Key '{e.args[0]}' not found in result. Skipping this result.")
|
823 |
continue
|
824 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
825 |
return all_results
|
826 |
|
827 |
perform_search_btn_els.click(
|
828 |
perform_date_range_els_search,
|
829 |
-
inputs=[start_date_els, end_date_els, names_input_els, search_type_els, search_term_els, gematria_sum_search_els, search_mode_els, include_torah_chk_els, include_bible_chk_els, include_quran_chk_els, include_hindu_chk_els, include_tripitaka_chk_els],
|
830 |
outputs=[filtered_results_output_els]
|
831 |
)
|
832 |
|
|
|
719 |
include_quran_chk_els = gr.Checkbox(label="Include Quran", value=True)
|
720 |
include_hindu_chk_els = gr.Checkbox(label="Include Rigveda", value=False)
|
721 |
include_tripitaka_chk_els = gr.Checkbox(label="Include Tripitaka", value=False)
|
722 |
+
with gr.Row():
|
723 |
+
translate_results_chk_els = gr.Checkbox(label="Translate Results to English", value=False)
|
724 |
|
725 |
with gr.Row():
|
726 |
perform_search_btn_els = gr.Button("Perform Search")
|
|
|
741 |
)
|
742 |
|
743 |
# Hauptfunktion für den vierten Tab
|
744 |
+
def perform_date_range_els_search(start_date, end_date, names_input, search_type, search_term, gematria_sum_search, search_mode, include_torah, include_bible, include_quran, include_hindu, include_tripitaka, translate_results):
|
745 |
names = [n.strip() for n in names_input.split("\n") if n.strip()]
|
746 |
date_gematrias = perform_gematria_calculation_for_date_range(start_date, end_date)
|
747 |
|
|
|
824 |
logger.error(f"KeyError - Key '{e.args[0]}' not found in result. Skipping this result.")
|
825 |
continue
|
826 |
|
827 |
+
# Übersetzung der Ergebnisse, falls angefordert
|
828 |
+
if translate_results:
|
829 |
+
for result_entry in all_results:
|
830 |
+
try:
|
831 |
+
text_to_translate = result_entry["result"]["result_text"]
|
832 |
+
source_lang = result_entry["result"].get("source_language", "auto")
|
833 |
+
translated_text = translation_utils.get_translation(text_to_translate, "en", source_lang)
|
834 |
+
result_entry["result"]["translated_text"] = translated_text[0]
|
835 |
+
except KeyError as e:
|
836 |
+
logger.error(f"KeyError translating result_text: {e}")
|
837 |
+
|
838 |
return all_results
|
839 |
|
840 |
perform_search_btn_els.click(
|
841 |
perform_date_range_els_search,
|
842 |
+
inputs=[start_date_els, end_date_els, names_input_els, search_type_els, search_term_els, gematria_sum_search_els, search_mode_els, include_torah_chk_els, include_bible_chk_els, include_quran_chk_els, include_hindu_chk_els, include_tripitaka_chk_els, translate_results_chk_els],
|
843 |
outputs=[filtered_results_output_els]
|
844 |
)
|
845 |
|