freemt
commited on
Commit
·
30153bc
1
Parent(s):
238bf96
Update using blocks
Browse files
app.py
CHANGED
@@ -24,6 +24,12 @@ def opusmt(
|
|
24 |
except Exception:
|
25 |
to_lang = "auto"
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
logger.debug("%s, %s, %s", text[:100], from_lang, to_lang)
|
28 |
if to_lang in ["auto"]:
|
29 |
if from_lang in ["zh"]:
|
@@ -42,7 +48,11 @@ def opusmt(
|
|
42 |
)
|
43 |
except Exception as e:
|
44 |
logger.error(e)
|
45 |
-
|
|
|
|
|
|
|
|
|
46 |
return res
|
47 |
|
48 |
|
@@ -64,7 +74,7 @@ outputs = [
|
|
64 |
),
|
65 |
]
|
66 |
|
67 |
-
description = """Supported languages: aav, aed, af, alv, am, ar, art, ase, az, bat, bcl, be, bem, ber, bg, bi, bn, bnt, bzs, ca, cau, ccs, ceb, cel, chk, cpf, crs, cs, csg, csn, cus, cy, da, de, dra, ee, efi, el, en, eo, es, et, eu, euq, fi, fj, fr, fse, ga, gaa, gil, gl, grk, guw, gv, ha, he, hi, hil, ho, hr, ht, hu, hy, id, ig, ilo, is, iso, it, ja, jap, ka, kab, kg, kj, kl, ko, kqn, kwn, kwy, lg, ln, loz, lt, lu, lua, lue, lun, luo, lus, lv, map, mfe, mfs, mg, mh, mk, mkh, ml, mos, mr, ms, mt, mul, ng, nic, niu, nl, no, nso, ny, nyk, om, pa, pag, pap, phi, pis, pl, pon, poz, pqe, pqw, prl, pt, rn, rnd, ro, roa, ru, run, rw, sal, sg, sh, sit, sk, sl, sm, sn, sq, srn, ss, ssp, st, sv, sw, swc, taw, tdt, th, ti, tiv, tl, tll, tn, to, toi, tpi, tr, trk, ts, tum, tut, tvl, tw, ty, tzo, uk, umb, ur, ve, vi, vsl, wa, wal, war, wls, xh, yap, yo, yua, zai, zh, zne. Refer to [https://github.com/UKPLab/EasyNMT](https://github.com/UKPLab/EasyNMT) for details. Estimated speed 6-60 sents/sec.
|
68 |
"""
|
69 |
|
70 |
_ = """
|
|
|
24 |
except Exception:
|
25 |
to_lang = "auto"
|
26 |
|
27 |
+
# if empty, set to auto
|
28 |
+
if not from_lang:
|
29 |
+
from_lang = "auto"
|
30 |
+
if not to_lang:
|
31 |
+
to_lang = "auto"
|
32 |
+
|
33 |
logger.debug("%s, %s, %s", text[:100], from_lang, to_lang)
|
34 |
if to_lang in ["auto"]:
|
35 |
if from_lang in ["zh"]:
|
|
|
48 |
)
|
49 |
except Exception as e:
|
50 |
logger.error(e)
|
51 |
+
if "Helsinki" in str(e):
|
52 |
+
res = "errors occur"
|
53 |
+
else:
|
54 |
+
res = f"errors: {e}"
|
55 |
+
|
56 |
return res
|
57 |
|
58 |
|
|
|
74 |
),
|
75 |
]
|
76 |
|
77 |
+
description = """Supported languages: aav, aed, af, alv, am, ar, art, ase, az, bat, bcl, be, bem, ber, bg, bi, bn, bnt, bzs, ca, cau, ccs, ceb, cel, chk, cpf, crs, cs, csg, csn, cus, cy, da, de, dra, ee, efi, el, en, eo, es, et, eu, euq, fi, fj, fr, fse, ga, gaa, gil, gl, grk, guw, gv, ha, he, hi, hil, ho, hr, ht, hu, hy, id, ig, ilo, is, iso, it, ja, jap, ka, kab, kg, kj, kl, ko, kqn, kwn, kwy, lg, ln, loz, lt, lu, lua, lue, lun, luo, lus, lv, map, mfe, mfs, mg, mh, mk, mkh, ml, mos, mr, ms, mt, mul, ng, nic, niu, nl, no, nso, ny, nyk, om, pa, pag, pap, phi, pis, pl, pon, poz, pqe, pqw, prl, pt, rn, rnd, ro, roa, ru, run, rw, sal, sg, sh, sit, sk, sl, sm, sn, sq, srn, ss, ssp, st, sv, sw, swc, taw, tdt, th, ti, tiv, tl, tll, tn, to, toi, tpi, tr, trk, ts, tum, tut, tvl, tw, ty, tzo, uk, umb, ur, ve, vi, vsl, wa, wal, war, wls, xh, yap, yo, yua, zai, zh, zne. Refer to [https://github.com/UKPLab/EasyNMT](https://github.com/UKPLab/EasyNMT) for details. Estimated speed: 6-60 sents/sec.
|
78 |
"""
|
79 |
|
80 |
_ = """
|