Introducing Gradio Clients
WatchIntroducing Gradio Clients
WatchNew to Gradio? Start here: Getting Started
See the Release History
To install Gradio from main, run the following command:
pip install https://gradio-builds.s3.amazonaws.com/d8c939444451e8ce80a6256daba3ab7fbc1dcac3/gradio-4.44.1-py3-none-any.whl*Note: Setting share=True in
launch() will not work.
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())simplify_file_data: bool= 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)hf_token: strThe HuggingFace token to use to create (and write the flagged sample to) the HuggingFace dataset (defaults to the registered one).
dataset_name: strThe repo_id of the dataset to save the data to, e.g. "image-classifier-1" or "username/image-classifier-1".
private: bool= False Whether the dataset should be private (defaults to False).
info_filename: str= "dataset_info.json" The name of the file to save the dataset info (defaults to "dataset_infos.json").
separate_dirs: bool= 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.