Custom Components GalleryNEW
ExploreCustom Components GalleryNEW
ExploreNew to Gradio? Start here: Getting Started
See the Release History
gradio.SimpleCSVLogger(···)
import gradio as gr
def image_classifier(inp):
return {'cat': 0.3, 'dog': 0.7}
demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label",
flagging_callback=SimpleCSVLogger())
gradio.CSVLogger(···)
import gradio as gr
def image_classifier(inp):
return {'cat': 0.3, 'dog': 0.7}
demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label",
flagging_callback=CSVLogger())
Parameter | Description |
---|---|
simplify_file_data bool default: True |
gradio.HuggingFaceDatasetSaver(hf_token, dataset_name, ···)
import gradio as gr
hf_writer = gr.HuggingFaceDatasetSaver(HF_API_TOKEN, "image-classification-mistakes")
def image_classifier(inp):
return {'cat': 0.3, 'dog': 0.7}
demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label",
allow_flagging="manual", flagging_callback=hf_writer)
Parameter | Description |
---|---|
hf_token str required | The HuggingFace token to use to create (and write the flagged sample to) the HuggingFace dataset (defaults to the registered one). |
dataset_name str required | The repo_id of the dataset to save the data to, e.g. "image-classifier-1" or "username/image-classifier-1". |
private bool default: False | Whether the dataset should be private (defaults to False). |
info_filename str default: "dataset_info.json" | The name of the file to save the dataset info (defaults to "dataset_infos.json"). |
separate_dirs bool default: False | If True, each flagged item will be saved in a separate directory. This makes the flagging more robust to concurrent editing, but may be less convenient to use. |