Gradio 시그니처: Python 함수가 UI 됨
함수 정의. gr.Interface 또는 gr.Blocks 로 wrap. Gradio 가 시그니처 inspect, inputs/outputs 자동 빌드, 웹 UI 서빙. demo.launch() 가 로컬 서버 시작; Spaces 에선 런타임이 자동 launch() 호출.
레이아웃 둘
gr.Interface(fn, inputs, outputs)— 함수 하나, UI 하나. 단일 task 데모에 best.gr.Blocks()— explicit 레이아웃. 여러 inputs/outputs, 탭, 커스텀 CSS, 조건부 visibility. Interface 가 너무 rigid 할 때.
Streaming 과 ChatInterface
챗 모델엔 gr.ChatInterface 가 메시지 history + streaming 을 generator-based handler 로 핸들. InferenceClient 또는 로컬 모델과 같은 패턴.