embed / app.py
om-app's picture
Rename embed.py to app.py
c1fc34b
raw
history blame
588 Bytes
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>")