File size: 588 Bytes
8901f41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from transformers import pipeline

def embed_html(html_frame):
    return gr.outputs.HTML(html_frame)

def hugging_face_fn(inputs):
    return {"output": embed_html(inputs)}

iface = gr.Interface(
    fn=hugging_face_fn,
    inputs=gr.inputs.Textbox(label="Enter HTML frame here"),
    outputs="html",
    title="HTML Frame Embedder",
    description="Input an HTML frame and see it embedded below."
)

model = pipeline("text-generation", model="gpt2")
model.add_pipe(iface)

model("Hello world! This is an HTML frame <iframe src='https://www.example.com'></iframe>")