Skip to main content

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.
  • ...

Metadata

Release files for gradio-iframe 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gradio-iframe 0.0.10
File Size Uploaded
gradio_iframe-0.0.10.tar.gz 32.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gradio-iframe 0.0.10
File Interpreter ABI Platform
gradio_iframe-0.0.10-py3-none-any.whl Python 3 none any Details

Total release size: 56.4 kB

Release files / gradio_iframe-0.0.10.tar.gz

Download URL gradio_iframe-0.0.10.tar.gz
Size 32.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ac3ca8d1dbdb6a5dc0c56f4d93262c95eed25c4c7e3b49309c23ba15f9a3f75d
BLAKE2b-256 checksum
How to use checksums
468ee0d96706b3e19ce5752d065627cd02d08d15d4c9802d6aa4e638e71aab5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / gradio_iframe-0.0.10-py3-none-any.whl

Download URL gradio_iframe-0.0.10-py3-none-any.whl
Size 24.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91932be427abc4d724d4660bc97cb0f9975112a2b4e891840c5d48b489e9625d
BLAKE2b-256 checksum
How to use checksums
4c6595e0a2df92a8509e0c7a265e34b29197bfc52a6f9dcff40613c72ee1789c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.0.10 This release

2 release files

0.0.9

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page