Rename embed.js to embed.py
Browse files- embed.js → embed.py +9 -2
embed.js → embed.py
RENAMED
@@ -1,14 +1,21 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
def embed_html(html_frame):
|
4 |
return gr.outputs.HTML(html_frame)
|
5 |
|
|
|
|
|
|
|
6 |
iface = gr.Interface(
|
7 |
-
fn=
|
8 |
inputs=gr.inputs.Textbox(label="Enter HTML frame here"),
|
9 |
outputs="html",
|
10 |
title="HTML Frame Embedder",
|
11 |
description="Input an HTML frame and see it embedded below."
|
12 |
)
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
def embed_html(html_frame):
|
5 |
return gr.outputs.HTML(html_frame)
|
6 |
|
7 |
+
def hugging_face_fn(inputs):
|
8 |
+
return {"output": embed_html(inputs)}
|
9 |
+
|
10 |
iface = gr.Interface(
|
11 |
+
fn=hugging_face_fn,
|
12 |
inputs=gr.inputs.Textbox(label="Enter HTML frame here"),
|
13 |
outputs="html",
|
14 |
title="HTML Frame Embedder",
|
15 |
description="Input an HTML frame and see it embedded below."
|
16 |
)
|
17 |
|
18 |
+
model = pipeline("text-generation", model="gpt2")
|
19 |
+
model.add_pipe(iface)
|
20 |
+
|
21 |
+
model("Hello world! This is an HTML frame <iframe src='https://www.example.com'></iframe>")
|