import gradio as gr def play_midi(midi_file): # You would use a library like mido to handle the MIDI file # For the purpose of this example, we'll just return the MIDI file path return midi_file.name css = """ """ html = """
""" with gr.Blocks() as demo: midi_file = gr.File(label="Upload MIDI File", file_count="single", file_types=[".mid"]) gr.Markdown(css) midi_url = gr.Variable(value="") gr.Markdown(html) midi_file.change(fn=play_midi, inputs=midi_file, outputs=midi_url) demo.launch()