1. Helpers
  2. DeletedFileData

New 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/3fcd23a09df280468351eac4fb081e79c8e58216/gradio-6.0.1-py3-none-any.whl

*Note: Setting share=True in launch() will not work.

DeletedFileData

gradio.DeletedFileData(···)

Description

The gr.DeletedFileData class is a subclass of gr.EventData that specifically carries information about the .delete() event. When gr.DeletedFileData is added as a type hint to an argument of an event listener method, a gr.DeletedFileData object will automatically be passed as the value of that argument. The attributes of this object contains information about the event that triggered the listener.

Example Usage

import gradio as gr

def test(delete_data: gr.DeletedFileData):
    return delete_data.file.path

with gr.Blocks() as demo:
    files = gr.File(file_count="multiple")
    deleted_file = gr.File()
    files.delete(test, None, deleted_file)

demo.launch()

Attributes

Parameters
🔗
file: FileData

The file that was deleted, as a FileData object. The str path to the file can be retrieved with the .path attribute.

Demos