Spaces:
Running
Running
LennardZuendorf
commited on
Commit
•
f5df450
1
Parent(s):
e59d663
Upload folder using huggingface_hub
Browse files- README.md +8 -38
- src/.gitignore +3 -0
- src/backend/gradio_iframe/iframe.pyi +1 -1
- src/pyproject.toml +2 -2
README.md
CHANGED
@@ -1,47 +1,17 @@
|
|
|
|
1 |
---
|
2 |
-
title: gradio iFrame (Demo)
|
3 |
tags: [gradio-custom-component,gradio-template-HTML,HTML,iFrame]
|
4 |
-
|
5 |
-
colorFrom:
|
6 |
-
colorTo:
|
7 |
sdk: docker
|
8 |
pinned: false
|
9 |
-
license:
|
10 |
---
|
11 |
|
12 |
-
# gradio iFrame
|
13 |
-
A custom gradio component to embed an iframe in a gradio interface. This component is based on the [HTML]() component.
|
14 |
-
It's currently still a work in progress.
|
15 |
-
|
16 |
-
## Usage
|
17 |
-
|
18 |
-
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.
|
19 |
-
|
20 |
-
You can still pass normal html that's not interactive.
|
21 |
-
|
22 |
-
### Example
|
23 |
-
|
24 |
-
```python
|
25 |
-
import gradio as gr
|
26 |
-
from gradio_iframe import iFrame
|
27 |
-
|
28 |
-
gr.Interface(
|
29 |
-
iFrame(
|
30 |
-
label="iFrame Example",
|
31 |
-
value=("https://www.youtube.com/watch?v=dQw4w9WgXcQ"),
|
32 |
-
heigth="500px",
|
33 |
-
show_label=True)
|
34 |
-
)
|
35 |
-
```
|
36 |
-
|
37 |
-
## Known Issues
|
38 |
-
|
39 |
-
**There are many reason why it's not a good idea to embed websites in an iframe.**
|
40 |
-
See [this](https://blog.bitsrc.io/4-security-concerns-with-iframes-every-web-developer-should-know-24c73e6a33e4), or just google "iframe security concerns" for more information. Also, iFrames will use additional computing power and memory, which can slow down the interface.
|
41 |
|
42 |
-
|
43 |
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
- ...
|
|
|
1 |
+
|
2 |
---
|
|
|
3 |
tags: [gradio-custom-component,gradio-template-HTML,HTML,iFrame]
|
4 |
+
title: gradio_iframe V0.0.4
|
5 |
+
colorFrom: red
|
6 |
+
colorTo: red
|
7 |
sdk: docker
|
8 |
pinned: false
|
9 |
+
license: apache-2.0
|
10 |
---
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
# Name: gradio_iframe
|
14 |
|
15 |
+
Description: Experimental empowered iFrame component based on existing HTML gradio component.
|
16 |
|
17 |
+
Install with: pip install gradio_iframe
|
|
src/.gitignore
CHANGED
@@ -6,3 +6,6 @@ __pycache__/
|
|
6 |
__tmp/*
|
7 |
*.pyi
|
8 |
node_modules
|
|
|
|
|
|
|
|
6 |
__tmp/*
|
7 |
*.pyi
|
8 |
node_modules
|
9 |
+
./dist/
|
10 |
+
./dist
|
11 |
+
/dist/
|
src/backend/gradio_iframe/iframe.pyi
CHANGED
@@ -49,7 +49,7 @@ class iFrame(Component):
|
|
49 |
elem_id: An optional string that is assigned as the id of this component in the iFrame DOM. Can be used for targeting CSS styles.
|
50 |
elem_classes: An optional list of strings that are assigned as the classes of this component in the iFrame DOM. Can be used for targeting CSS styles.
|
51 |
render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
|
52 |
-
height: The height of the iFrame in
|
53 |
"""
|
54 |
super().__init__(
|
55 |
label=label,
|
|
|
49 |
elem_id: An optional string that is assigned as the id of this component in the iFrame DOM. Can be used for targeting CSS styles.
|
50 |
elem_classes: An optional list of strings that are assigned as the classes of this component in the iFrame DOM. Can be used for targeting CSS styles.
|
51 |
render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
|
52 |
+
height: The height of the iFrame in valid css (i.e "10px). If None, the height will be automatically set to 100%
|
53 |
"""
|
54 |
super().__init__(
|
55 |
label=label,
|
src/pyproject.toml
CHANGED
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
|
|
8 |
|
9 |
[project]
|
10 |
name = "gradio_iframe"
|
11 |
-
version = "0.0.
|
12 |
description = "Experimental empowered iFrame component based on existing HTML gradio component."
|
13 |
readme = "README.md"
|
14 |
license = "MIT"
|
@@ -36,7 +36,7 @@ classifiers = [
|
|
36 |
dev = ["build", "twine"]
|
37 |
|
38 |
[tool.hatch.build]
|
39 |
-
artifacts = ["/backend/gradio_iframe/templates", "*.pyi", "backend/gradio_iframe/templates", "home/lennard/.virtualenvs/thesis/lib/python3.11/site-packages/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates"]
|
40 |
|
41 |
[tool.hatch.build.targets.wheel]
|
42 |
packages = ["/backend/gradio_iframe"]
|
|
|
8 |
|
9 |
[project]
|
10 |
name = "gradio_iframe"
|
11 |
+
version = "0.0.5"
|
12 |
description = "Experimental empowered iFrame component based on existing HTML gradio component."
|
13 |
readme = "README.md"
|
14 |
license = "MIT"
|
|
|
36 |
dev = ["build", "twine"]
|
37 |
|
38 |
[tool.hatch.build]
|
39 |
+
artifacts = ["/backend/gradio_iframe/templates", "*.pyi", "backend/gradio_iframe/templates", "home/lennard/.virtualenvs/thesis/lib/python3.11/site-packages/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates"]
|
40 |
|
41 |
[tool.hatch.build.targets.wheel]
|
42 |
packages = ["/backend/gradio_iframe"]
|