huggingface-gradio
Skill này làm gì
Skill này giúp AI xây dựng các ứng dụng web nhỏ và demo machine learning bằng thư viện Gradio cho Python. Skill dành cho lập trình viên và nhà nghiên cứu muốn chia sẻ một model trong giao diện trình duyệt đơn giản.
Khi nào nên dùng
- ✓Khi bạn muốn xây dựng một demo web hoặc giao diện cho model machine learning bằng Python.
- ✓Khi bạn cần một chatbot, biểu mẫu hoặc bố cục tùy chỉnh được xây bằng Gradio.
- ✓Khi bạn muốn thay đổi thành phần hoặc xử lý sự kiện của một ứng dụng Gradio có sẵn.
Liên kết skill
https://github.com/huggingface/skills/blob/main/skills/huggingface-gradio/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Xây dựng một demo Gradio nơi tôi gõ một câu và xem kết quả cảm xúc từ model của tôi.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI viết một ứng dụng Python nhỏ bao bọc một hàm với các phần đầu vào và đầu ra, hoặc xây một bố cục tùy chỉnh với các event listener. AI làm theo các mẫu Gradio chuẩn để ứng dụng chạy được trên trình duyệt.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Gradio
Gradio is a Python library for building interactive web UIs and ML demos. This skill covers the core API, patterns, and examples.
Guides
Detailed guides on specific topics (read these when relevant):
- Quickstart
- The Interface Class
- Blocks and Event Listeners
- Controlling Layout
- More Blocks Features
- Custom CSS and JS
- Streaming Outputs
- Streaming Inputs
- Sharing Your App
- Custom HTML Components
- Getting Started with the Python Client
- Getting Started with the JS Client
Core Patterns
Interface (high-level): wraps a function with input/output components.
import gradio as gr
def greet(name):
return f"Hello {name}!"
gr.Interface(fn=greet, inputs="text", outputs="text").launch()
Blocks (low-level): flexible layout with explicit event wiring.
import gradio as gr
with gr.Blocks() as demo:
name = gr.Textbox(label="Name")
output = gr.Textbox(label="Greeting")
btn = gr.Button("Greet")
btn.click(fn=lambda n: f"Hello {n}!", inputs=name, outputs=output)
demo.launch()
ChatInterface: high-level wrapper for chatbot UIs.
import gradio as gr
def respond(message, history):
return f"You said: {message}"
gr.ChatInterface(fn=respond).launch()
Key Component Signatures
Textbox(value: str | I18nData | Callable | None = None, type: Literal['text', 'password', 'email'] = "text", lines: int = 1, max_lines: int | None = None, placeholder: str | I18nData | None = None, label: str | I18nData | None = None, info: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, container: bool = True, scale: int | None = None, min_width: int = 160, interactive: bool | None = None, visible: bool | Literal['hidden'] = True, elem_id: str | None = None, autofocus: bool = False, autoscroll: bool = True, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", text_align: Literal['left', 'right'] | None = None, rtl: bool = False, buttons: list[Literal['copy'] | Button] | None = None, max_length: int | None = None, submit_btn: str | bool | None = False, stop_btn: str | bool | None = False, html_attributes: InputHTMLAttributes | None = None)
Creates a textarea for user to enter string input or display string output..
Number(value: float | Callable | None = None, label: str | I18nData | None = None, placeholder: str | I18nData | None = None, info: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, container: bool = True, scale: int | None = None, min_width: int = 160, interactive: bool | None = None, visible: bool | Literal['hidden'] = True, elem_id: str | None = None, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", buttons: list[Button] | None = None, precision: int | None = None, minimum: float | None = None, maximum: float | None = None, step: float = 1)
Creates a numeric field for user to enter numbers as input or display numeric output..
`Slider(minimum: float = 0, maximum: float = 100, value: float | Callable | None = None, step: float | None = None, precision: int | None = None, label: str | I18nData | None = None, info: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, container: bool = True, scale: int | None = None, min_width: int = 160, interactive: bool | None = None, visible: bool
Câu hỏi thường gặp
Tôi có cần kỹ năng phát triển web không?
Không. Gradio cho phép bạn xây giao diện bằng Python, không cần viết HTML hay JavaScript cho các phần thông thường.
Skill có làm được chatbot không?
Có. Giao diện chatbot là một trong những mẫu phổ biến mà skill bao quát.
Tôi có thể tùy chỉnh giao diện không?
Có. Skill bao quát bố cục, cùng CSS và JavaScript tùy chỉnh khi bạn cần.
Chi tiết
Mô tả gốc của tác giả
Build Gradio web UIs and demos in Python. Use when creating or editing Gradio apps, components, event listeners, layouts, or chatbots.
repo: huggingface/skills
Độ phổ biến
- Sao GitHub
- 11k
- Vị trí xếp hạng
- #11773
- Giấy phép
- Apache-2.0
- Cập nhật
- 30/10/2026
Bình luận
- …
Thêm skill từ kho mã này
hf-cli
11kGiúp agent của bạn dùng công cụ dòng lệnh Hugging Face để tải xuống, tải lên và quản lý model, dataset, Spaces, repo và bộ nhớ đệm cục bộ.
hf-cloud-aws-context-discovery
11kGiúp agent của bạn tìm AWS profile, region và thông tin tài khoản trước khi làm bất kỳ việc gì trên cloud, để không phải đoán tài khoản nào sẽ dùng.
hf-cloud-python-env-setup
11kGiúp agent của bạn thiết lập môi trường Python sạch với phiên bản Python phù hợp và thư viện mới nhất trước khi chạy SageMaker hoặc tự động hóa AWS.
hf-cloud-sagemaker-deployment-planner
11kGiúp agent của bạn lên kế hoạch triển khai model lên Amazon SageMaker, chọn lưu trữ thời gian thực, serverless, async hoặc batch với mặc định hợp lý.
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.