Spaces:
Build error
Build error
freemt
commited on
Commit
•
7d6526a
1
Parent(s):
8d76292
Update a few hours of comma bug!
Browse files- ubee/__main__.py +12 -10
ubee/__main__.py
CHANGED
@@ -31,6 +31,8 @@ import pandas as pd
|
|
31 |
from icecream import ic
|
32 |
from icecream import install as ic_install
|
33 |
from logzero import logger
|
|
|
|
|
34 |
|
35 |
# for embeddable python
|
36 |
# if "." not in sys.path: sys.path.insert(0, ".")
|
@@ -51,6 +53,7 @@ ic.enable()
|
|
51 |
|
52 |
ic(" ic.enabled ")
|
53 |
|
|
|
54 |
ic("Testing...")
|
55 |
import model_pool
|
56 |
from model_pool import fetch_check_aux
|
@@ -67,6 +70,7 @@ try:
|
|
67 |
clas = load_model("clas-l-user")
|
68 |
except Exception as _:
|
69 |
ic(["load_model(\"clas-l-user\")", _])
|
|
|
70 |
|
71 |
# _ = clas("love", ["liebe", "hate you", "test"])
|
72 |
# print(_)
|
@@ -94,12 +98,6 @@ def ifn(
|
|
94 |
Returns:
|
95 |
pd.DataFrame
|
96 |
"""
|
97 |
-
# global text1, text2, thresh
|
98 |
-
ic(text1)
|
99 |
-
ic(text2)
|
100 |
-
ic(type(text1))
|
101 |
-
ic(type(text2))
|
102 |
-
|
103 |
res1 = [elm.strip() for elm in text1.splitlines() if elm.strip()]
|
104 |
res2 = [elm.strip() for elm in text2.splitlines() if elm.strip()]
|
105 |
|
@@ -110,6 +108,7 @@ def ifn(
|
|
110 |
# return _
|
111 |
|
112 |
res1_, res2_ = ubee(res1, res2, thresh)
|
|
|
113 |
|
114 |
out_df = pd.DataFrame(
|
115 |
zip_longest(res1, res2),
|
@@ -205,7 +204,7 @@ def main():
|
|
205 |
placeholder=placeholder,
|
206 |
value=ex2_zh,
|
207 |
label="text1"
|
208 |
-
)
|
209 |
text2 = gr.Textbox(
|
210 |
lines=lines,
|
211 |
placeholder=placeholder,
|
@@ -222,7 +221,7 @@ def main():
|
|
222 |
)
|
223 |
btn = gr.Button("Run")
|
224 |
|
225 |
-
out_df = gr.
|
226 |
headers=None,
|
227 |
max_rows=lines, # 20
|
228 |
max_cols=None,
|
@@ -232,7 +231,7 @@ def main():
|
|
232 |
)
|
233 |
|
234 |
# with gr.Row():
|
235 |
-
aligned = gr.
|
236 |
headers=None,
|
237 |
max_rows=lines, # 20
|
238 |
max_cols=None,
|
@@ -241,7 +240,7 @@ def main():
|
|
241 |
label="Aligned",
|
242 |
)
|
243 |
|
244 |
-
leftover = gr.
|
245 |
headers=None,
|
246 |
max_rows=lines, # 20
|
247 |
max_cols=None,
|
@@ -250,6 +249,9 @@ def main():
|
|
250 |
label="Leftover",
|
251 |
)
|
252 |
|
|
|
|
|
|
|
253 |
btn.click(
|
254 |
fn=ifn,
|
255 |
inputs=[
|
|
|
31 |
from icecream import ic
|
32 |
from icecream import install as ic_install
|
33 |
from logzero import logger
|
34 |
+
from set_loglevel import set_loglevel
|
35 |
+
logzero.loglevel(set_loglevel())
|
36 |
|
37 |
# for embeddable python
|
38 |
# if "." not in sys.path: sys.path.insert(0, ".")
|
|
|
53 |
|
54 |
ic(" ic.enabled ")
|
55 |
|
56 |
+
_ = """
|
57 |
ic("Testing...")
|
58 |
import model_pool
|
59 |
from model_pool import fetch_check_aux
|
|
|
70 |
clas = load_model("clas-l-user")
|
71 |
except Exception as _:
|
72 |
ic(["load_model(\"clas-l-user\")", _])
|
73 |
+
# """
|
74 |
|
75 |
# _ = clas("love", ["liebe", "hate you", "test"])
|
76 |
# print(_)
|
|
|
98 |
Returns:
|
99 |
pd.DataFrame
|
100 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
res1 = [elm.strip() for elm in text1.splitlines() if elm.strip()]
|
102 |
res2 = [elm.strip() for elm in text2.splitlines() if elm.strip()]
|
103 |
|
|
|
108 |
# return _
|
109 |
|
110 |
res1_, res2_ = ubee(res1, res2, thresh)
|
111 |
+
# res1_, res2_ = res1, res2
|
112 |
|
113 |
out_df = pd.DataFrame(
|
114 |
zip_longest(res1, res2),
|
|
|
204 |
placeholder=placeholder,
|
205 |
value=ex2_zh,
|
206 |
label="text1"
|
207 |
+
)
|
208 |
text2 = gr.Textbox(
|
209 |
lines=lines,
|
210 |
placeholder=placeholder,
|
|
|
221 |
)
|
222 |
btn = gr.Button("Run")
|
223 |
|
224 |
+
out_df = gr.Dataframe(
|
225 |
headers=None,
|
226 |
max_rows=lines, # 20
|
227 |
max_cols=None,
|
|
|
231 |
)
|
232 |
|
233 |
# with gr.Row():
|
234 |
+
aligned = gr.Dataframe(
|
235 |
headers=None,
|
236 |
max_rows=lines, # 20
|
237 |
max_cols=None,
|
|
|
240 |
label="Aligned",
|
241 |
)
|
242 |
|
243 |
+
leftover = gr.Dataframe(
|
244 |
headers=None,
|
245 |
max_rows=lines, # 20
|
246 |
max_cols=None,
|
|
|
249 |
label="Leftover",
|
250 |
)
|
251 |
|
252 |
+
logger.debug("text1: %s", text1)
|
253 |
+
logger.debug("text2: %s", text2)
|
254 |
+
|
255 |
btn.click(
|
256 |
fn=ifn,
|
257 |
inputs=[
|