modusa 0.4.18__py3-none-any.whl → 0.4.19__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
modusa/__init__.py CHANGED
@@ -8,4 +8,4 @@ from modusa.tools import play, convert, record, save
8
8
  from modusa.tools import download
9
9
  from modusa.tools import load, load_ann
10
10
 
11
- __version__ = "0.4.18"
11
+ __version__ = "0.4.19"
modusa/images/icon.png ADDED
Binary file
@@ -5,11 +5,22 @@ import numpy as np
5
5
 
6
6
  from IPython.display import Audio, HTML, display
7
7
  import numpy as np
8
+ from pathlib import Path
8
9
 
9
- def play(y: np.ndarray, sr: float, clip: tuple[float, float] | None = None, label: str | None = None) -> None:
10
+ from IPython.display import Audio, HTML, display
11
+ from pathlib import Path
12
+ import numpy as np
13
+ import base64
14
+
15
+ def play(
16
+ y: np.ndarray,
17
+ sr: float,
18
+ clip: tuple[float, float] | None = None,
19
+ label: str | None = None,
20
+ ) -> None:
10
21
  """
11
- Audio player with optional clip selection and transcription-style label.
12
- Displays a clean caption box with bold timing and text, followed by the player.
22
+ Audio player with optional clip selection, transcription-style label,
23
+ and an embedded bottom-right logo (../images/icon.png).
13
24
  """
14
25
  start_time, end_time = 0.0, len(y) / sr
15
26
 
@@ -22,8 +33,36 @@ def play(y: np.ndarray, sr: float, clip: tuple[float, float] | None = None, labe
22
33
  y = y[start_sample:end_sample]
23
34
  start_time, end_time = clip
24
35
 
25
- # Build HTML
36
+ # Load and embed logo image as base64
37
+ logo_path = Path(__file__).resolve().parent.parent / "images" / "icon.png"
38
+ logo_size = 40
39
+ logo_html = ""
40
+ logo_link = "https://meluron.github.io/modusa"
41
+
42
+ if logo_path.exists():
43
+ with open(logo_path, "rb") as f:
44
+ encoded_logo = base64.b64encode(f.read()).decode("utf-8")
45
+
46
+ # Wrap logo in <a> so it's clickable
47
+ logo_html = f"""
48
+ <a href="{logo_link}" target="_blank" style="text-decoration:none;">
49
+ <img src="data:image/png;base64,{encoded_logo}"
50
+ style="
51
+ position:absolute;
52
+ bottom:8px;
53
+ right:10px;
54
+ width:{logo_size}px;
55
+ height:{logo_size}px;
56
+ opacity:0.8;
57
+ transition:opacity 0.2s ease;
58
+ "
59
+ onmouseover="this.style.opacity=1.0"
60
+ onmouseout="this.style.opacity=0.8"
61
+ />
62
+ </a>
63
+ """
26
64
  audio_html = Audio(data=y, rate=sr)._repr_html_()
65
+
27
66
  label_html = f"""
28
67
  <div style="
29
68
  margin-top:4px;
@@ -42,19 +81,22 @@ def play(y: np.ndarray, sr: float, clip: tuple[float, float] | None = None, labe
42
81
  html = f"""
43
82
  <div style="
44
83
  display:inline-block;
84
+ position:relative;
45
85
  border:1px solid #e0e0e0;
46
86
  border-radius:10px;
47
- padding:12px 16px;
87
+ padding:14px 18px 36px 18px;
48
88
  background:#fff;
49
89
  font-family:sans-serif;
50
- max-width:800px;
90
+ max-width:520px;
51
91
  box-shadow:0 1px 3px rgba(0,0,0,0.05);
52
92
  ">
53
93
  {label_html}
54
94
  <div style="margin-top:10px;">
55
95
  {audio_html}
56
96
  </div>
97
+ {logo_html}
57
98
  </div>
58
99
  """
59
100
 
60
- display(HTML(html))
101
+ display(HTML(html))
102
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: modusa
3
- Version: 0.4.18
3
+ Version: 0.4.19
4
4
  Summary: A modular signal analysis python library.
5
5
  Author-Email: Ankit Anand <ankit0.anand0@gmail.com>
6
6
  License: MIT
@@ -1,8 +1,8 @@
1
- modusa-0.4.18.dist-info/METADATA,sha256=ijcc3CRYEE39kmdPI-3IbUqNJMLejQsDa3dxTOQMmYc,1467
2
- modusa-0.4.18.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
- modusa-0.4.18.dist-info/entry_points.txt,sha256=fmKpleVXj6CdaBVL14WoEy6xx7JQCs85jvzwTi3lePM,73
4
- modusa-0.4.18.dist-info/licenses/LICENSE.md,sha256=JTaXAjx5awk76VArKCx5dUW8vmLEWsL_ZlR7-umaHbA,1078
5
- modusa/__init__.py,sha256=Nz1_T0fAmYwdZRz5338H-VemTVvhJQplGeOPKpSXeTQ,324
1
+ modusa-0.4.19.dist-info/METADATA,sha256=jZ2emn6r_qiC6o7cJ_cE8QnRqXQtQNDtF506lZHFcBg,1467
2
+ modusa-0.4.19.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
+ modusa-0.4.19.dist-info/entry_points.txt,sha256=fmKpleVXj6CdaBVL14WoEy6xx7JQCs85jvzwTi3lePM,73
4
+ modusa-0.4.19.dist-info/licenses/LICENSE.md,sha256=JTaXAjx5awk76VArKCx5dUW8vmLEWsL_ZlR7-umaHbA,1078
5
+ modusa/__init__.py,sha256=pzlE_KWZVC_e_9FLMeeQt6v8CWUklMGoExtfCLOii0Q,324
6
6
  modusa/config.py,sha256=bTqK4t00FZqERVITrxW_q284aDDJAa9aMSfFknfR-oU,280
7
7
  modusa/decorators.py,sha256=8zeNX_wE37O6Vp0ysR4-WCZaEL8mq8dyCF_I5DHOzks,5905
8
8
  modusa/devtools/generate_docs_source.py,sha256=UDflHsk-Yh9-3YJTVBzKL32y8hcxiRgAlFEBTMiDqwM,3301
@@ -27,6 +27,7 @@ modusa/generators/s2d.py,sha256=kU67dZj4tdIDSUFJeheXm_JKbyHpZZOGmW5jya6w0wo,6874
27
27
  modusa/generators/s_ax.py,sha256=4CTFp_KwYnl4HDno-ATpTXOfKR9WEVOV45nwuk2OoVk,2221
28
28
  modusa/generators/t_ax.py,sha256=X-XOJuGWw99dPAVsCVzNTfBFr81Vw56aZlGDmcl5q3k,1478
29
29
  modusa/generators/tds.py,sha256=eGvzcjXyWaw5NVzM3D098r3xkoMcX8Ma9YoDUdL30Mo,5960
30
+ modusa/images/icon.png,sha256=UgGXlL4xjdIYxqO1en3iQfNN1BFsazxpT7NiPZSDu70,13321
30
31
  modusa/models/__init__.py,sha256=G8sNOnBnTKqPmC4Z46ximBhc_pfBOF_G6AIfxT8DFzw,271
31
32
  modusa/models/audio.py,sha256=IcNx3h8tb5Jt6KZug_TQKM5iufVk3i7Ug37iKG4gsJ0,2411
32
33
  modusa/models/base.py,sha256=1qAXj69VsmrjGqShl5b27Jvt7OADHmPY0L9fBtpB_1E,1621
@@ -44,7 +45,7 @@ modusa/tools/_plotter_old.py,sha256=KGow7mihA2H1WNq7s5bpivhCgGo2qVIeDaO6iabpsrg,
44
45
  modusa/tools/ann_loader.py,sha256=BEdwAh_lccx_SnAO3bNMeY3O5zGiJlH2o4snWmXj8eQ,3034
45
46
  modusa/tools/audio_converter.py,sha256=415qBoPm2sBIuBSI7m1XBKm0AbmVmPydIPPr-uO8D3c,1778
46
47
  modusa/tools/audio_loader.py,sha256=n9Q9t_GmlE8AtioVwRcXX3rnd6PkbGTx-hAoNgUnNOQ,2780
47
- modusa/tools/audio_player.py,sha256=_OpRxImZAxfMB24MK9I8kgU8oqV5cKe8GZtDciCIYak,1512
48
+ modusa/tools/audio_player.py,sha256=NdWfL1hnlUJYEBpy7FBwbtST2wxaQ2zX5pIYzVSTXm4,2458
48
49
  modusa/tools/audio_recorder.py,sha256=K_LGqsPdjTdf3figEZTSQLmgMzYWgz18HTO8C1j5fE4,2788
49
50
  modusa/tools/audio_saver.py,sha256=ldzfr_AydsHTnKbxmBLJblN-hLzTmOlppOm306xI4Ug,510
50
51
  modusa/tools/base.py,sha256=C0ESJ0mIfjjRlAkRbSetNtMoOfS6IrHBjexRp3l_Mh4,1293
@@ -57,4 +58,4 @@ modusa/utils/excp.py,sha256=L9vhaGjKpv9viJYdmC9n5ndmk2GVbUBuFyZyhAQZmWY,906
57
58
  modusa/utils/logger.py,sha256=K0rsnObeNKCxlNeSnVnJeRhgfmob6riB2uyU7h3dDmA,571
58
59
  modusa/utils/np_func_cat.py,sha256=TyIFgRc6bARRMDnZxlVURO5Z0I-GWhxRONYyIv-Vwxs,1007
59
60
  modusa/utils/plot.py,sha256=s_vNdxvKfwxEngvJPgrF1PcmxZNnNaaXPViHWjyjJ-c,5335
60
- modusa-0.4.18.dist-info/RECORD,,
61
+ modusa-0.4.19.dist-info/RECORD,,