Spaces:
Runtime error
Runtime error
cryptocalypse
commited on
Commit
•
61a2d8c
1
Parent(s):
9af6155
entropy memory views
Browse files- app.py +15 -3
- lib/entropy.py +0 -9
app.py
CHANGED
@@ -1,10 +1,15 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
|
|
|
|
3 |
from lib.gematria import calculate_gematria, strip_diacritics
|
4 |
from lib.temuraeh import temura_conv
|
5 |
from lib.notarikon import notarikon
|
6 |
from lib.ziruph import encrypt,decrypt
|
|
|
7 |
from torahcodes.resources.func.torah import *
|
|
|
|
|
8 |
import math
|
9 |
import pandas as pd
|
10 |
import datetime
|
@@ -17,6 +22,13 @@ def get_time():
|
|
17 |
|
18 |
plot_end = 2 * math.pi
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
def get_plot(period=1):
|
22 |
global plot_end
|
@@ -267,11 +279,11 @@ with gr.Blocks(title="Sophia, Torah Codes",css=css,js=js) as app:
|
|
267 |
with gr.Tab("Entropy"):
|
268 |
zir_text2 = gr.Textbox(label="Text to analyze",scale=3)
|
269 |
zir_btn2 = gr.Button("Analyze",scale=1)
|
270 |
-
zir_result2 = gr.
|
271 |
|
272 |
zir_btn2.click(
|
273 |
-
|
274 |
-
inputs=[zir_text2
|
275 |
outputs=zir_result2
|
276 |
)
|
277 |
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
+
|
4 |
+
## TORAH CODES LIBS
|
5 |
from lib.gematria import calculate_gematria, strip_diacritics
|
6 |
from lib.temuraeh import temura_conv
|
7 |
from lib.notarikon import notarikon
|
8 |
from lib.ziruph import encrypt,decrypt
|
9 |
+
from lib.entropy import *
|
10 |
from torahcodes.resources.func.torah import *
|
11 |
+
|
12 |
+
## UTILS
|
13 |
import math
|
14 |
import pandas as pd
|
15 |
import datetime
|
|
|
22 |
|
23 |
plot_end = 2 * math.pi
|
24 |
|
25 |
+
def entropy_magic(texto_ejemplo):
|
26 |
+
|
27 |
+
text_processor = TextProcessor(texto_ejemplo)
|
28 |
+
spliter_optimo = text_processor.magic_split()
|
29 |
+
return (text_processor.entropy(),text_processor.tokenize(spliter_optimo))
|
30 |
+
|
31 |
+
|
32 |
|
33 |
def get_plot(period=1):
|
34 |
global plot_end
|
|
|
279 |
with gr.Tab("Entropy"):
|
280 |
zir_text2 = gr.Textbox(label="Text to analyze",scale=3)
|
281 |
zir_btn2 = gr.Button("Analyze",scale=1)
|
282 |
+
zir_result2 = gr.JSON()
|
283 |
|
284 |
zir_btn2.click(
|
285 |
+
entropy_magic,
|
286 |
+
inputs=[zir_text2],
|
287 |
outputs=zir_result2
|
288 |
)
|
289 |
|
lib/entropy.py
CHANGED
@@ -120,12 +120,3 @@ class TextProcessor:
|
|
120 |
return tokenized_sentence
|
121 |
|
122 |
|
123 |
-
# Example usage:
|
124 |
-
texto_ejemplo = sys.argv[1]
|
125 |
-
|
126 |
-
text_processor = TextProcessor(texto_ejemplo)
|
127 |
-
spliter_optimo = text_processor.magic_split()
|
128 |
-
print("Spliter óptimo:", spliter_optimo)
|
129 |
-
print(text_processor.entropy())
|
130 |
-
print(text_processor.tokenize(spliter_optimo))
|
131 |
-
|
|
|
120 |
return tokenized_sentence
|
121 |
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|