mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-03 04:02:49 +08:00
18 lines
616 B
Python
18 lines
616 B
Python
import gradio as gr
|
|
from typing import TYPE_CHECKING, Tuple
|
|
|
|
if TYPE_CHECKING:
|
|
from gradio.blocks import Block
|
|
from gradio.components import Component
|
|
|
|
|
|
def create_preview_box() -> Tuple["Block", "Component", "Component", "Component"]:
|
|
with gr.Column(visible=False, elem_classes="modal-box") as preview_box:
|
|
preview_count = gr.Number(interactive=False)
|
|
preview_samples = gr.JSON(interactive=False)
|
|
close_btn = gr.Button()
|
|
|
|
close_btn.click(lambda: gr.update(visible=False), outputs=[preview_box], queue=False)
|
|
|
|
return preview_box, preview_count, preview_samples, close_btn
|