Spaces:
Runtime error
Runtime error
freemt
commited on
Commit
·
60d8e03
1
Parent(s):
31198fb
app.py
CHANGED
@@ -8,7 +8,7 @@ import logzero
|
|
8 |
from logzero import logger
|
9 |
from set_loglevel import set_loglevel
|
10 |
|
11 |
-
from gradio_cmat import gradio_cmat
|
12 |
|
13 |
pd.set_option("display.precision", 2)
|
14 |
pd.options.display.float_format = "{:,.2f}".format
|
@@ -16,7 +16,8 @@ logzero.loglevel(set_loglevel(10, force=True))
|
|
16 |
model = model_s()
|
17 |
|
18 |
|
19 |
-
def fn(text1: str, text2: str) -> np.ndarray:
|
|
|
20 |
"""Define."""
|
21 |
list1 = [elm.strip() for elm in text1.splitlines() if elm.strip()]
|
22 |
list2 = [elm.strip() for elm in text2.splitlines() if elm.strip()]
|
@@ -38,7 +39,7 @@ def fn(text1: str, text2: str) -> np.ndarray:
|
|
38 |
# raise
|
39 |
|
40 |
# return res.round(2)
|
41 |
-
return pd.
|
42 |
|
43 |
|
44 |
out_df = gr.outputs.Dataframe(
|
@@ -76,13 +77,12 @@ try:
|
|
76 |
article="Click 'Clear' first for subsequent new texts",
|
77 |
examples=[
|
78 |
["test\nabc", "测试"],
|
79 |
-
["This is a text.\nIch liebe Dich.\nabc",
|
80 |
-
"我爱你\nI love you.\n测试\nbcd"],
|
81 |
],
|
82 |
)
|
83 |
-
except Exception as
|
84 |
logger.exception("")
|
85 |
-
logger.error("gr.Interface.load(%s): %s", "fn",
|
86 |
raise
|
87 |
|
88 |
interface.launch()
|
|
|
8 |
from logzero import logger
|
9 |
from set_loglevel import set_loglevel
|
10 |
|
11 |
+
from gradio_cmat.gradio_cmat import gradio_cmat
|
12 |
|
13 |
pd.set_option("display.precision", 2)
|
14 |
pd.options.display.float_format = "{:,.2f}".format
|
|
|
16 |
model = model_s()
|
17 |
|
18 |
|
19 |
+
# def fn(text1: str, text2: str) -> np.ndarray:
|
20 |
+
def fn(text1: str, text2: str) -> pd.DataFrame:
|
21 |
"""Define."""
|
22 |
list1 = [elm.strip() for elm in text1.splitlines() if elm.strip()]
|
23 |
list2 = [elm.strip() for elm in text2.splitlines() if elm.strip()]
|
|
|
39 |
# raise
|
40 |
|
41 |
# return res.round(2)
|
42 |
+
return pd.DataFrame(res)
|
43 |
|
44 |
|
45 |
out_df = gr.outputs.Dataframe(
|
|
|
77 |
article="Click 'Clear' first for subsequent new texts",
|
78 |
examples=[
|
79 |
["test\nabc", "测试"],
|
80 |
+
["This is a text.\nIch liebe Dich.\nabc", "我爱你\nI love you.\n测试\nbcd"],
|
|
|
81 |
],
|
82 |
)
|
83 |
+
except Exception as exc:
|
84 |
logger.exception("")
|
85 |
+
logger.error("gr.Interface.load(%s): %s", "fn", exc)
|
86 |
raise
|
87 |
|
88 |
interface.launch()
|
gradio_cmat/__pycache__/__init__.cpython-38.pyc
CHANGED
Binary files a/gradio_cmat/__pycache__/__init__.cpython-38.pyc and b/gradio_cmat/__pycache__/__init__.cpython-38.pyc differ
|
|
gradio_cmat/__pycache__/gradio_cmat.cpython-38.pyc
ADDED
Binary file (1.2 kB). View file
|
|