Bringing ML to Life: Gradio + Reveal.js via quarto-gradio

🤗 Sentiment Analysis via Transformers.js

import gradio as gr
from transformers_js_py import pipeline

pipe = await pipeline("sentiment-analysis")

async def process(text):
    return await pipe(text)

demo = gr.Interface(
    fn=process,
    inputs=gr.Textbox(value="Change this text, then click 'Submit'"),
    outputs="json",
    flagging_mode="never",
)

demo.launch()

🤗 Sentiment Analysis via Transformers.js

transformers-js-py import gradio as gr from transformers_js_py import pipeline pipe = await pipeline("sentiment-analysis") async def process(text): return await pipe(text) demo = gr.Interface( fn=process, inputs=gr.Textbox(value="Change this text, then click 'Submit'"), outputs="json", flagging_mode="never", ) demo.launch()

🛝 Coding Playground

import gradio as gr

gr.Interface(
    fn=lambda name: f"Hi {name}!",
    inputs="textbox",
    outputs="textbox",
    live=True,
).launch()

🛝 Coding Playground

transformers-js-py import gradio as gr gr.Interface( fn=lambda name: f"Hi {name}!", inputs="textbox", outputs="textbox", live=True, ).launch()