Python library for easily interacting with trained machine learning models
Project description
tags: [gradio-custom-component, ] title: gradio_gradio_hls_player short_description: A gradio custom component colorFrom: blue colorTo: yellow sdk: gradio pinned: false app_file: space.py
gradio_hls_player
Python library for easily interacting with trained machine learning models
Installation
pip install gradio_hls_player
Usage
import gradio as gr
from gradio_hls_player import GradioHLSPlayer
def create_hls_app():
with gr.Blocks() as demo:
gr.Markdown("# Gradio HLS Stream Player")
with gr.Row():
url_input = gr.Textbox(
label="Enter M3U8 URL",
value="https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
placeholder="Paste HLS stream URL here..."
)
submit_btn = gr.Button("Load Stream", variant="primary")
with gr.Row():
width_slider = gr.Slider(
label="Width",
minimum=320,
maximum=1920,
value=640,
step=10
)
height_slider = gr.Slider(
label="Height",
minimum=180,
maximum=1080,
value=360,
step=10
)
autoplay_checkbox = gr.Checkbox(label="Autoplay", value=False)
hide_controls_checkbox = gr.Checkbox(label="Hide Controls", value=False)
hls_player = GradioHLSPlayer(
value={
"url": "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
"width": 640,
"height": 360,
"autoplay": False,
"hide_player_control_bar": False
},
label="HLS Video Player"
)
def update_player(url, width, height, autoplay, hide_controls):
return {
"url": url,
"width": width,
"height": height,
"autoplay": autoplay,
"hide_player_control_bar": hide_controls
}
url_input.change(
fn=update_player,
inputs=[url_input, width_slider, height_slider, autoplay_checkbox, hide_controls_checkbox],
outputs=hls_player
)
submit_btn.click(
fn=update_player,
inputs=[url_input, width_slider, height_slider, autoplay_checkbox, hide_controls_checkbox],
outputs=hls_player
)
return demo
if __name__ == "__main__":
app = create_hls_app()
app.launch()
GradioHLSPlayer
Initialization
| name | type | default | description |
|---|---|---|---|
value |
typing.Dict[str, typing.Any][str, typing.Any]
|
None |
None |
Events
| name | description |
|---|---|
play |
|
pause |
|
error |
User function
The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
- When used as an Input, the component only impacts the input signature of the user function.
- When used as an output, the component only impacts the return signature of the user function.
The code snippet below is accurate in cases where the component is used as both an input and an output.
- As output: Is passed, the preprocessed input data sent to the user's function in the backend.
- As input: Should return, the output data received by the component from the user's function in the backend.
def predict(
value: typing.Dict[str, typing.Any][str, typing.Any]
) -> typing.Dict[str, typing.Any][str, typing.Any]:
return value
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gradio_hls_player-0.0.1.tar.gz.
File metadata
- Download URL: gradio_hls_player-0.0.1.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae19874c56332a4db3e32a816ac43290a4bbab539ddc07443663f63524e57d5d
|
|
| MD5 |
c1d917315d7aa3bd627385f7102087ce
|
|
| BLAKE2b-256 |
d24d009e95ea1fdeea4bd8c53e83e7b766aea54a7133a44a4344b7638fc7c7e4
|
File details
Details for the file gradio_hls_player-0.0.1-py3-none-any.whl.
File metadata
- Download URL: gradio_hls_player-0.0.1-py3-none-any.whl
- Upload date:
- Size: 1.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b69958db82829b53e3037e4bacfebf269b85fc6894bbec712a499adfe2f76c7
|
|
| MD5 |
50570e50fef78679dcf4ec7607e596ac
|
|
| BLAKE2b-256 |
507e2b66d4a954ba62d3fcd6a8bc1f9100fab11297cde8e8be736a6a7e0fec43
|