Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -21,20 +21,14 @@ CACHE_FILE = "tanakh_phrasedict.cache"
|
|
21 |
|
22 |
def get_power_result(total_sum: int, query_value: int) -> int:
|
23 |
"""Calculates the power or root result."""
|
24 |
-
if
|
25 |
return 1
|
26 |
-
if query_value
|
27 |
try:
|
28 |
exponent = int(math.floor(math.log(total_sum, query_value)))
|
29 |
return query_value ** exponent
|
30 |
except (ValueError, OverflowError):
|
31 |
return 1
|
32 |
-
else:
|
33 |
-
try:
|
34 |
-
exponent = int(math.floor(math.log(query_value, total_sum)))
|
35 |
-
return total_sum ** exponent
|
36 |
-
except (ValueError, OverflowError):
|
37 |
-
return 1
|
38 |
|
39 |
def find_all_matching_phrases(target_sum: int, phrase_dictionary: Dict[int, List[Dict]]) -> List[Dict]:
|
40 |
"""Finds all phrases matching a target Gematria."""
|
@@ -105,8 +99,13 @@ def run_analysis(query: str, translate: bool, process_verses: int, results_per_v
|
|
105 |
verse_sum = calculate_gematria(verse_text)
|
106 |
if verse_sum <= 1: continue
|
107 |
|
108 |
-
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
110 |
main_matches = find_all_matching_phrases(main_target_sum, phrase_dictionary)
|
111 |
|
112 |
verse_ref = f"B{book_num:02d}, C{chap_idx}, V{verse_idx}"
|
@@ -173,7 +172,7 @@ def run_analysis(query: str, translate: bool, process_verses: int, results_per_v
|
|
173 |
return "\n".join(output_lines)
|
174 |
|
175 |
# --- Gradio UI Definition ---
|
176 |
-
# Custom CSS
|
177 |
custom_css = """
|
178 |
#output_markdown h3 {
|
179 |
color: #f97316; /* Vibrant orange for main resonance headers */
|
|
|
21 |
|
22 |
def get_power_result(total_sum: int, query_value: int) -> int:
|
23 |
"""Calculates the power or root result."""
|
24 |
+
if query_value <= 1:
|
25 |
return 1
|
26 |
+
if query_value < total_sum:
|
27 |
try:
|
28 |
exponent = int(math.floor(math.log(total_sum, query_value)))
|
29 |
return query_value ** exponent
|
30 |
except (ValueError, OverflowError):
|
31 |
return 1
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
def find_all_matching_phrases(target_sum: int, phrase_dictionary: Dict[int, List[Dict]]) -> List[Dict]:
|
34 |
"""Finds all phrases matching a target Gematria."""
|
|
|
99 |
verse_sum = calculate_gematria(verse_text)
|
100 |
if verse_sum <= 1: continue
|
101 |
|
102 |
+
if query_value < verse_sum:
|
103 |
+
power_result = get_power_result(verse_sum, query_value)
|
104 |
+
main_target_sum = verse_sum ^ power_result
|
105 |
+
elif query_value > verse_sum:
|
106 |
+
main_target_sum = query_value ^ verse_sum
|
107 |
+
elif query_value == verse_sum:
|
108 |
+
main_target_sum = verse_sum
|
109 |
main_matches = find_all_matching_phrases(main_target_sum, phrase_dictionary)
|
110 |
|
111 |
verse_ref = f"B{book_num:02d}, C{chap_idx}, V{verse_idx}"
|
|
|
172 |
return "\n".join(output_lines)
|
173 |
|
174 |
# --- Gradio UI Definition ---
|
175 |
+
# Custom CSS fse:or a professional dark theme inspired by the screenshot
|
176 |
custom_css = """
|
177 |
#output_markdown h3 {
|
178 |
color: #f97316; /* Vibrant orange for main resonance headers */
|