Spaces:
Sleeping
Sleeping
freemt
commited on
Commit
β’
66fcc65
1
Parent(s):
6bf2aa9
Update pytest OK
Browse files- README.md +1 -1
- README1.md +2 -2
- app_mlbee.py +9 -9
- pyproject.toml +8 -8
- st_mlbee/__init__.py +2 -2
- st_mlbee/gen_cmat.py +1 -1
- st_mlbee/{mlbee.py β st_mlbee.py} +4 -4
- tests/test_gen_cmat_aset2pairs.py +2 -2
- tests/test_mlbee.py +4 -4
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title: mlbee
|
3 |
emoji: π
|
4 |
colorFrom: indigo
|
5 |
colorTo: yellow
|
|
|
1 |
---
|
2 |
+
title: st-mlbee
|
3 |
emoji: π
|
4 |
colorFrom: indigo
|
5 |
colorTo: yellow
|
README1.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
# mlbee
|
2 |
-
[![pytest](https://github.com/ffreemt/mlbee/actions/workflows/routine-tests.yml/badge.svg)](https://github.com/ffreemt/mlbee/actions)[![python](https://img.shields.io/static/v1?label=python+&message=3.8&color=blue)](https://www.python.org/downloads/)[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)[![PyPI version](https://badge.fury.io/py/mlbee.svg)](https://badge.fury.io/py/mlbee)
|
3 |
|
4 |
mlbee descr
|
5 |
|
@@ -13,6 +13,6 @@ pip install git+https://github.com/ffreemt/mlbee
|
|
13 |
|
14 |
## Use it
|
15 |
```python
|
16 |
-
from
|
17 |
|
18 |
```
|
|
|
1 |
# mlbee
|
2 |
+
[![pytest](https://github.com/ffreemt/mlbee/actions/workflows/routine-tests.yml/badge.svg)](https://github.com/ffreemt/mlbee/actions)[![python](https://img.shields.io/static/v1?label=python+&message=3.8&color=blue)](https://www.python.org/downloads/)[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)[![PyPI version](https://badge.fury.io/py/st-mlbee.svg)](https://badge.fury.io/py/st-mlbee)
|
3 |
|
4 |
mlbee descr
|
5 |
|
|
|
13 |
|
14 |
## Use it
|
15 |
```python
|
16 |
+
from st_mlbee import st_mlbee
|
17 |
|
18 |
```
|
app_mlbee.py
CHANGED
@@ -58,17 +58,17 @@ from logzero import logger
|
|
58 |
from set_loglevel import set_loglevel
|
59 |
from streamlit import session_state as state
|
60 |
|
61 |
-
from
|
62 |
-
from
|
63 |
-
from
|
64 |
|
65 |
-
from
|
66 |
-
from
|
67 |
-
from
|
68 |
-
from
|
69 |
|
70 |
# curr_py = sys.version[:3]
|
71 |
-
# msg = f"Some packages mlbee depends on can only run with Python 3.8, current python is **{curr_py}**, sorry..."
|
72 |
# assert curr_py == "3.8", msg
|
73 |
|
74 |
os.environ["TZ"] = "Asia/Shanghai"
|
@@ -98,7 +98,7 @@ loggu.add(
|
|
98 |
# from PIL import Image
|
99 |
# page_icon=Image.open("icon.ico"),
|
100 |
st.set_page_config( # type: ignore
|
101 |
-
page_title=f"mlbee v{__version__}",
|
102 |
# page_icon="π§",
|
103 |
page_icon="π",
|
104 |
# layout="wide",
|
|
|
58 |
from set_loglevel import set_loglevel
|
59 |
from streamlit import session_state as state
|
60 |
|
61 |
+
from st_mlbee import __version__
|
62 |
+
from st_mlbee.utils import menu_items
|
63 |
+
from st_mlbee.multipage import Multipage
|
64 |
|
65 |
+
from st_mlbee.home import home
|
66 |
+
from st_mlbee.settings import settings
|
67 |
+
from st_mlbee.info import info
|
68 |
+
from st_mlbee.utils import style_css
|
69 |
|
70 |
# curr_py = sys.version[:3]
|
71 |
+
# msg = f"Some packages st-mlbee depends on can only run with Python 3.8, current python is **{curr_py}**, sorry..."
|
72 |
# assert curr_py == "3.8", msg
|
73 |
|
74 |
os.environ["TZ"] = "Asia/Shanghai"
|
|
|
98 |
# from PIL import Image
|
99 |
# page_icon=Image.open("icon.ico"),
|
100 |
st.set_page_config( # type: ignore
|
101 |
+
page_title=f"st-mlbee v{__version__}",
|
102 |
# page_icon="π§",
|
103 |
page_icon="π",
|
104 |
# layout="wide",
|
pyproject.toml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
[tool.poetry]
|
2 |
name = "mlbee"
|
3 |
version = "0.1.0-alpha.1"
|
4 |
-
description = "mlbee"
|
5 |
authors = ["ffreemt"]
|
6 |
license = "MIT"
|
7 |
readme = "README.md"
|
@@ -37,18 +37,18 @@ type = "poetry"
|
|
37 |
[tool.poe.tasks]
|
38 |
memo = "echo poe test or poetry run poe test"
|
39 |
test = "pytest tests"
|
40 |
-
pyright = "pyright
|
41 |
-
flake8 = "flake8
|
42 |
check = ["pyright", "flake8"]
|
43 |
export = "poetry export --without-hashes -f requirements.txt -o requirements.txt"
|
44 |
build = "poetry build"
|
45 |
publish = "poetry publish"
|
46 |
release = ["test", "build", "publish"]
|
47 |
-
lint = { cmd = "pylint
|
48 |
-
isort = "isort tests
|
49 |
-
black = "black tests
|
50 |
formt = ["isort", "black"]
|
51 |
-
docstyle = "pydocstyle --convention=google tests
|
52 |
prerelease = {cmd = "poetry version prerelease && sync-version"}
|
53 |
tunnel = {cmd = "ssh -CN ip_or_hostname_defined_in_hosts -L 9091:127.0.0.1:9091"}
|
54 |
|
@@ -61,7 +61,7 @@ toml = "^0.10.2"
|
|
61 |
poethepoet = "^0.10.0"
|
62 |
|
63 |
[tool.poetry.scripts]
|
64 |
-
"mlbee" = "
|
65 |
|
66 |
[build-system]
|
67 |
requires = ["poetry-core>=1.0.0"]
|
|
|
1 |
[tool.poetry]
|
2 |
name = "mlbee"
|
3 |
version = "0.1.0-alpha.1"
|
4 |
+
description = "st-mlbee"
|
5 |
authors = ["ffreemt"]
|
6 |
license = "MIT"
|
7 |
readme = "README.md"
|
|
|
37 |
[tool.poe.tasks]
|
38 |
memo = "echo poe test or poetry run poe test"
|
39 |
test = "pytest tests"
|
40 |
+
pyright = "pyright st_mlbee"
|
41 |
+
flake8 = "flake8 st_mlbee --ignore F401,E501,F841"
|
42 |
check = ["pyright", "flake8"]
|
43 |
export = "poetry export --without-hashes -f requirements.txt -o requirements.txt"
|
44 |
build = "poetry build"
|
45 |
publish = "poetry publish"
|
46 |
release = ["test", "build", "publish"]
|
47 |
+
lint = { cmd = "pylint st_mlbee" }
|
48 |
+
isort = "isort tests st_mlbee"
|
49 |
+
black = "black tests st_mlbee"
|
50 |
formt = ["isort", "black"]
|
51 |
+
docstyle = "pydocstyle --convention=google tests st_mlbee"
|
52 |
prerelease = {cmd = "poetry version prerelease && sync-version"}
|
53 |
tunnel = {cmd = "ssh -CN ip_or_hostname_defined_in_hosts -L 9091:127.0.0.1:9091"}
|
54 |
|
|
|
61 |
poethepoet = "^0.10.0"
|
62 |
|
63 |
[tool.poetry.scripts]
|
64 |
+
"st-mlbee" = "st_mlbee.__main__:app"
|
65 |
|
66 |
[build-system]
|
67 |
requires = ["poetry-core>=1.0.0"]
|
st_mlbee/__init__.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
"""Init."""
|
2 |
__version__ = "0.1.0a1"
|
3 |
-
from .
|
4 |
|
5 |
-
__all__ = ("
|
|
|
1 |
"""Init."""
|
2 |
__version__ = "0.1.0a1"
|
3 |
+
from .st_mlbee import st_mlbee
|
4 |
|
5 |
+
__all__ = ("st_mlbee",)
|
st_mlbee/gen_cmat.py
CHANGED
@@ -12,7 +12,7 @@ from tqdm import tqdm
|
|
12 |
from hf_model_s_cpu import model_s
|
13 |
from logzero import logger
|
14 |
|
15 |
-
from
|
16 |
|
17 |
try:
|
18 |
model = model_s()
|
|
|
12 |
from hf_model_s_cpu import model_s
|
13 |
from logzero import logger
|
14 |
|
15 |
+
from st_mlbee.cos_matrix2 import cos_matrix2
|
16 |
|
17 |
try:
|
18 |
model = model_s()
|
st_mlbee/{mlbee.py β st_mlbee.py}
RENAMED
@@ -5,10 +5,10 @@ from typing import List
|
|
5 |
from cmat2aset import cmat2aset
|
6 |
from logzero import logger
|
7 |
|
8 |
-
from
|
9 |
|
10 |
|
11 |
-
def
|
12 |
text1: List[str],
|
13 |
text2: List[str],
|
14 |
eps: float = 10,
|
@@ -36,7 +36,7 @@ def mlbee(
|
|
36 |
# from json_de2zh.gen_cmat import gen_cmat # noqa # pylint: disable=import-outside-toplevel
|
37 |
cmat = gen_cmat(text1, text2)
|
38 |
# logger.level is reset to 20 in fastlid
|
39 |
-
|
40 |
except Exception as e:
|
41 |
logger.exception(e)
|
42 |
raise
|
@@ -44,7 +44,7 @@ def mlbee(
|
|
44 |
try:
|
45 |
# aset = cmat2aset(cmat.T)
|
46 |
aset = cmat2aset(cmat, eps=eps, min_samples=min_samples)
|
47 |
-
|
48 |
except Exception as e:
|
49 |
logger.exception(e)
|
50 |
raise
|
|
|
5 |
from cmat2aset import cmat2aset
|
6 |
from logzero import logger
|
7 |
|
8 |
+
from st_mlbee.gen_cmat import gen_cmat
|
9 |
|
10 |
|
11 |
+
def st_mlbee(
|
12 |
text1: List[str],
|
13 |
text2: List[str],
|
14 |
eps: float = 10,
|
|
|
36 |
# from json_de2zh.gen_cmat import gen_cmat # noqa # pylint: disable=import-outside-toplevel
|
37 |
cmat = gen_cmat(text1, text2)
|
38 |
# logger.level is reset to 20 in fastlid
|
39 |
+
st_mlbee.cmat = cmat
|
40 |
except Exception as e:
|
41 |
logger.exception(e)
|
42 |
raise
|
|
|
44 |
try:
|
45 |
# aset = cmat2aset(cmat.T)
|
46 |
aset = cmat2aset(cmat, eps=eps, min_samples=min_samples)
|
47 |
+
st_mlbee.aset = aset
|
48 |
except Exception as e:
|
49 |
logger.exception(e)
|
50 |
raise
|
tests/test_gen_cmat_aset2pairs.py
CHANGED
@@ -31,8 +31,8 @@ len(" ".join(en2)) # 31478
|
|
31 |
"""
|
32 |
from cmat2aset import cmat2aset
|
33 |
from aset2pairs import aset2pairs
|
34 |
-
from
|
35 |
-
from
|
36 |
|
37 |
paras1 = loadparas("data/sternstunden04-en.txt")
|
38 |
paras2 = loadparas("data/sternstunden04-de.txt")
|
|
|
31 |
"""
|
32 |
from cmat2aset import cmat2aset
|
33 |
from aset2pairs import aset2pairs
|
34 |
+
from st_mlbee.gen_cmat import gen_cmat
|
35 |
+
from st_mlbee.loadtext import loadparas
|
36 |
|
37 |
paras1 = loadparas("data/sternstunden04-en.txt")
|
38 |
paras2 = loadparas("data/sternstunden04-de.txt")
|
tests/test_mlbee.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
"""Test
|
2 |
# pylint: disable=broad-except
|
3 |
-
from
|
4 |
-
from
|
5 |
|
6 |
|
7 |
def test_version():
|
@@ -12,6 +12,6 @@ def test_version():
|
|
12 |
def test_sanity():
|
13 |
"""Check sanity."""
|
14 |
try:
|
15 |
-
assert not
|
16 |
except Exception:
|
17 |
assert True
|
|
|
1 |
+
"""Test st_mlbee."""
|
2 |
# pylint: disable=broad-except
|
3 |
+
from st_mlbee import __version__
|
4 |
+
from st_mlbee import st_mlbee
|
5 |
|
6 |
|
7 |
def test_version():
|
|
|
12 |
def test_sanity():
|
13 |
"""Check sanity."""
|
14 |
try:
|
15 |
+
assert not st_mlbee()
|
16 |
except Exception:
|
17 |
assert True
|