#!/usr/bin/env python """01 -- gr.Interface: the shortest path from a function to a web UI. python 01_hello_interface.py """ import gradio as gr from _common import launch, no_flagging def greet(name: str, intensity: int) -> str: return f"Hello, {name or 'world'}" + "!" * int(intensity) demo = gr.Interface( fn=greet, inputs=[ gr.Textbox(label="Name", placeholder="type a name"), gr.Slider(1, 10, value=3, step=1, label="Intensity"), ], outputs=gr.Textbox(label="Greeting"), title="Hello, gradio", description="Offline gr.Interface smoke test for RHEL 9.6.", # A cached example would try to run at build time; keep it simple. examples=[["RHEL", 3], ["air-gapped", 7]], cache_examples=False, # Otherwise gradio writes flagged samples into ./flagged/ on first use. **no_flagging(), ) if __name__ == "__main__": launch(demo)