streamlit-bar-visualizer 0.1.0__tar.gz

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.
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,4 @@
1
+ include streamlit_bar_visualizer/frontend/build/index.html
2
+ include streamlit_bar_visualizer/frontend/build/static/js/*.js
3
+ include streamlit_bar_visualizer/frontend/build/static/css/*.css
4
+
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.4
2
+ Name: streamlit-bar-visualizer
3
+ Version: 0.1.0
4
+ Summary: Beautiful audio frequency visualizer component for Streamlit with multiple state animations
5
+ Home-page: https://github.com/bensonbs/streamlit-bar-visualizer
6
+ Author: Benson Sung
7
+ Author-email: Benson Sung <benson.bs.sung@gmail.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/bensonbs/streamlit-bar-visualizer
10
+ Project-URL: Repository, https://github.com/bensonbs/streamlit-bar-visualizer
11
+ Project-URL: Issues, https://github.com/bensonbs/streamlit-bar-visualizer/issues
12
+ Keywords: streamlit,audio,visualizer,frequency,component
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: streamlit>=1.0.0
17
+ Dynamic: author
18
+ Dynamic: home-page
19
+ Dynamic: license-file
20
+ Dynamic: requires-python
21
+
22
+ # Streamlit Bar Visualizer
23
+
24
+ Audio frequency visualizer component for Streamlit, inspired by ElevenLabs UI design.
25
+
26
+ ![License](https://img.shields.io/badge/license-MIT-blue.svg)
27
+ ![Python](https://img.shields.io/badge/python-3.8+-blue.svg)
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ pip install streamlit-bar-visualizer
33
+ ```
34
+
35
+ ## Quick Start
36
+
37
+ ```python
38
+ from streamlit_bar_visualizer import bar_visualizer
39
+
40
+ # Basic usage
41
+ bar_visualizer(state="listening")
42
+
43
+ # With audio stream
44
+ bar_visualizer(
45
+ state="speaking",
46
+ stream_url="https://stream.live.vc.bbcmedia.co.uk/bbc_world_service"
47
+ )
48
+
49
+ # Auto mode - automatically changes state based on audio playback
50
+ bar_visualizer(
51
+ state="auto",
52
+ stream_url="https://stream.live.vc.bbcmedia.co.uk/bbc_world_service"
53
+ )
54
+ ```
55
+
56
+ ## API
57
+
58
+ ### `bar_visualizer(state, stream_url, key)`
59
+
60
+ **Parameters:**
61
+ - `state` (str): Animation state
62
+ - `"listening"` - Breathing animation
63
+ - `"speaking"` - Active speaking animation
64
+ - `"thinking"` - Pulsing animation
65
+ - `"connecting"` - Wave animation
66
+ - `"initializing"` - Building up animation
67
+ - `"auto"` - Auto-switch based on audio playback (thinking → speaking → initializing)
68
+ - `stream_url` (str, optional): Audio stream URL to visualize
69
+ - `key` (str, optional): Unique component identifier
70
+
71
+ **Returns:** Current component state (str)
72
+
73
+ ## Development
74
+
75
+ ```bash
76
+ # Install dependencies
77
+ cd streamlit_bar_visualizer/frontend
78
+ npm install
79
+
80
+ # Start dev server
81
+ npm run start
82
+
83
+ # Build for production
84
+ npm run build
85
+ ```
86
+
87
+ ## License
88
+
89
+ MIT
90
+
@@ -0,0 +1,69 @@
1
+ # Streamlit Bar Visualizer
2
+
3
+ Audio frequency visualizer component for Streamlit, inspired by ElevenLabs UI design.
4
+
5
+ ![License](https://img.shields.io/badge/license-MIT-blue.svg)
6
+ ![Python](https://img.shields.io/badge/python-3.8+-blue.svg)
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ pip install streamlit-bar-visualizer
12
+ ```
13
+
14
+ ## Quick Start
15
+
16
+ ```python
17
+ from streamlit_bar_visualizer import bar_visualizer
18
+
19
+ # Basic usage
20
+ bar_visualizer(state="listening")
21
+
22
+ # With audio stream
23
+ bar_visualizer(
24
+ state="speaking",
25
+ stream_url="https://stream.live.vc.bbcmedia.co.uk/bbc_world_service"
26
+ )
27
+
28
+ # Auto mode - automatically changes state based on audio playback
29
+ bar_visualizer(
30
+ state="auto",
31
+ stream_url="https://stream.live.vc.bbcmedia.co.uk/bbc_world_service"
32
+ )
33
+ ```
34
+
35
+ ## API
36
+
37
+ ### `bar_visualizer(state, stream_url, key)`
38
+
39
+ **Parameters:**
40
+ - `state` (str): Animation state
41
+ - `"listening"` - Breathing animation
42
+ - `"speaking"` - Active speaking animation
43
+ - `"thinking"` - Pulsing animation
44
+ - `"connecting"` - Wave animation
45
+ - `"initializing"` - Building up animation
46
+ - `"auto"` - Auto-switch based on audio playback (thinking → speaking → initializing)
47
+ - `stream_url` (str, optional): Audio stream URL to visualize
48
+ - `key` (str, optional): Unique component identifier
49
+
50
+ **Returns:** Current component state (str)
51
+
52
+ ## Development
53
+
54
+ ```bash
55
+ # Install dependencies
56
+ cd streamlit_bar_visualizer/frontend
57
+ npm install
58
+
59
+ # Start dev server
60
+ npm run start
61
+
62
+ # Build for production
63
+ npm run build
64
+ ```
65
+
66
+ ## License
67
+
68
+ MIT
69
+
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "streamlit-bar-visualizer"
7
+ version = "0.1.0"
8
+ description = "Beautiful audio frequency visualizer component for Streamlit with multiple state animations"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Benson Sung", email = "benson.bs.sung@gmail.com"}
14
+ ]
15
+ dependencies = [
16
+ "streamlit>=1.0.0",
17
+ ]
18
+ keywords = ["streamlit", "audio", "visualizer", "frequency", "component"]
19
+
20
+ [project.urls]
21
+ Homepage = "https://github.com/bensonbs/streamlit-bar-visualizer"
22
+ Repository = "https://github.com/bensonbs/streamlit-bar-visualizer"
23
+ Issues = "https://github.com/bensonbs/streamlit-bar-visualizer/issues"
24
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,36 @@
1
+ import setuptools
2
+ from pathlib import Path
3
+
4
+ this_directory = Path(__file__).parent
5
+ long_description = (this_directory / "README.md").read_text()
6
+
7
+ setuptools.setup(
8
+ name="streamlit-bar-visualizer",
9
+ version="0.1.0",
10
+ author="Benson Sung",
11
+ author_email="benson.bs.sung@gmail.com",
12
+ description="Beautiful audio frequency visualizer component for Streamlit with multiple state animations",
13
+ long_description=long_description,
14
+ long_description_content_type="text/markdown",
15
+ url="https://github.com/bensonbs/streamlit-bar-visualizer",
16
+ packages=setuptools.find_packages(),
17
+ include_package_data=True,
18
+ classifiers=[
19
+ "Development Status :: 4 - Beta",
20
+ "Intended Audience :: Developers",
21
+ "Topic :: Multimedia :: Sound/Audio :: Analysis",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.8",
24
+ "Programming Language :: Python :: 3.9",
25
+ "Programming Language :: Python :: 3.10",
26
+ "Programming Language :: Python :: 3.11",
27
+ "License :: OSI Approved :: MIT License",
28
+ "Operating System :: OS Independent",
29
+ ],
30
+ keywords="streamlit, audio, visualizer, frequency, component",
31
+ python_requires=">=3.8",
32
+ install_requires=[
33
+ "streamlit >= 1.0.0",
34
+ ],
35
+ )
36
+
@@ -0,0 +1,67 @@
1
+ import os
2
+ import streamlit.components.v1 as components
3
+
4
+ # Create a _RELEASE constant. We'll set this to False while we're developing
5
+ # the component, and True when we're ready to package and distribute it.
6
+ _RELEASE = True
7
+
8
+ if not _RELEASE:
9
+ _component_func = components.declare_component(
10
+ "bar_visualizer",
11
+ url="http://localhost:3001",
12
+ )
13
+ else:
14
+ parent_dir = os.path.dirname(os.path.abspath(__file__))
15
+ build_dir = os.path.join(parent_dir, "frontend/build")
16
+ _component_func = components.declare_component("bar_visualizer", path=build_dir)
17
+
18
+
19
+ def bar_visualizer(
20
+ state="listening",
21
+ stream_url=None,
22
+ key=None,
23
+ ):
24
+ """Display an audio frequency visualizer with animated state transitions.
25
+
26
+ Parameters
27
+ ----------
28
+ state : str
29
+ Voice assistant state: "connecting", "initializing", "listening", "speaking", "thinking", "auto"
30
+ - "auto": Automatically switch states based on audio playback:
31
+ * thinking: Audio loading
32
+ * speaking: Audio playing
33
+ * initializing: Audio ended
34
+ Default: "listening"
35
+ demo : bool
36
+ Enable demo mode with fake audio data.
37
+ Default: True
38
+ stream_url : str or None
39
+ URL of an audio stream to visualize. If provided, the component will
40
+ visualize this stream instead of using the microphone.
41
+ Default: None
42
+ key : str or None
43
+ An optional key that uniquely identifies this component. If this is
44
+ None, and the component's arguments are changed, the component will
45
+ be re-mounted in the Streamlit frontend and lose its current state.
46
+
47
+ Returns
48
+ -------
49
+ str
50
+ The current state of the component
51
+ """
52
+ component_value = _component_func(
53
+ state=state,
54
+ barCount=20,
55
+ minHeight=15,
56
+ maxHeight=90,
57
+ demo=False,
58
+ centerAlign=True,
59
+ streamUrl=stream_url,
60
+ key=key,
61
+ default=state,
62
+ )
63
+ return component_value
64
+
65
+
66
+ __all__ = ["bar_visualizer"]
67
+
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <meta name="theme-color" content="#000000" />
7
+ <meta name="description" content="Streamlit Bar Visualizer Component" />
8
+ <title>Streamlit Bar Visualizer</title>
9
+ <script type="module" crossorigin src="/static/js/index.js"></script>
10
+ <link rel="stylesheet" crossorigin href="/static/css/index.css">
11
+ </head>
12
+ <body>
13
+ <noscript>You need to enable JavaScript to run this app.</noscript>
14
+ <div id="root"></div>
15
+ </body>
16
+ </html>
17
+
@@ -0,0 +1 @@
1
+ *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.relative{position:relative}.flex{display:flex}.h-28{height:7rem}.w-full{width:100%}.min-w-\[8px\]{min-width:8px}.max-w-\[12px\]{max-width:12px}.flex-1{flex:1 1 0%}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-center{justify-content:center}.gap-1\.5{gap:.375rem}.overflow-hidden{overflow:hidden}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.bg-border{background-color:hsl(var(--border))}.bg-muted{background-color:hsl(var(--muted))}.bg-primary{background-color:hsl(var(--primary))}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-150{transition-duration:.15s}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--border: 214.3 31.8% 91.4%;--primary: 222.2 47.4% 11.2%}*{box-sizing:border-box}body{margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.streamlit-bar-visualizer{width:100%;padding:1rem}.data-\[highlighted\=true\]\:bg-primary[data-highlighted=true]{background-color:hsl(var(--primary))}