Experimental empowered iFrame component based on existing HTML gradio component.
Project description
gradio_iframe
A custom gradio component to embed an iframe in a gradio interface. This component is based on the HTML component. It's currently still a work in progress.
Usage
The usage is similar to the HTML component. You can pass valid html and it will be rendered in the interface as an iframe, meaning you can embed any website or webapp that supports iframes. Also, JavaScript should run normal. You can even pass an iframe inside an iframe (see below!), i.e. a youtube or spotify embed.
The size will adjust to the size of the iframe (onload), this is gonna be a bit delayed. The width is default at 100%. You can also set the height and width manually.
Example
import gradio as gr
from gradio_iframe import iFrame
gr.Interface(
iFrame(
label="iFrame Example",
value=("""
<iframe width="560"
height="315"
src="https://www.youtube.com/embed/dQw4w9WgXcQ?si=QfHLpHZsI98oZT1G"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen>
</iframe>"""),
show_label=True)
)
Roadmap
- Add manual hand over of other iFrame options.
- Explore switch between src and srcdoc through variable.
Known Issues
There are many reason why it's not a good idea to embed websites in an iframe. See this, or just google "iframe security concerns" for more information. Also, iFrames will use additional computing power and memory, which can slow down the interface.
Also, this component is still a work in progress and not fully tested. Use at your own risk.
Other Issues
- Height sometimes does not grow according to the inner component.
- The component is not completely responsive yet and struggles with variable heigth.
- ...
Project details
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
File details
Details for the file gradio_iframe-0.0.7.tar.gz
.
File metadata
- Download URL: gradio_iframe-0.0.7.tar.gz
- Upload date:
- Size: 32.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ed539713257c87c84510b3f4c6e6516b3ce157cd19b1ad87bab188e41672344 |
|
MD5 | 6635cc728a7c18ec1e270efdb88086f6 |
|
BLAKE2b-256 | 2255685d4e4b5f4a677ab1ee4e4185125b6cac04f919dd1daf7a7171adc494c1 |
File details
Details for the file gradio_iframe-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: gradio_iframe-0.0.7-py3-none-any.whl
- Upload date:
- Size: 24.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d5cd514dae62e0897d522707e03332e3d034b7020eb74992ddf0f1fdb9b4dd6 |
|
MD5 | 2deb7d65f26f86c75a7253ea8ac90315 |
|
BLAKE2b-256 | a005e5051f8f894d1dc4a210f0712f12f23c7300a73cc3c3473625a88b5e228b |