Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -1,6 +1,5 @@ | |
| 1 | 
            -
            import gradio as gr
         | 
| 2 | 
             
            import os
         | 
| 3 | 
            -
             | 
| 4 | 
             
            from midi_ddsp.midi_ddsp_synthesize import load_pretrained_model
         | 
| 5 | 
             
            from midi_ddsp.utils.midi_synthesis_utils import synthesize_mono_midi
         | 
| 6 | 
             
            from midi_ddsp.data_handling.instrument_name_utils import INST_NAME_TO_ID_DICT, INST_NAME_LIST
         | 
| @@ -11,13 +10,12 @@ synthesis_generator, expression_generator = load_pretrained_model() | |
| 11 | 
             
            def midi_ddsp_synth(instrument, midi_file):
         | 
| 12 | 
             
                '''
         | 
| 13 | 
             
                Paras:
         | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
             
                                                        'flute', 'oboe', 'clarinet', 'saxophone',
         | 
| 17 | 
             
                                                        'bassoon', 'trumpet', 'horn', 'trombone', 'tuba'                                            
         | 
| 18 | 
             
                Returns:
         | 
| 19 | 
            -
             | 
| 20 | 
            -
                x: the audio data
         | 
| 21 | 
             
                '''
         | 
| 22 | 
             
                if not (os.path.isfile(midi_file.name) and midi_file.name[-4:] == '.mid'):
         | 
| 23 | 
             
                    raise FileNotFoundError('Error: not a valid midi file')
         | 
| @@ -36,7 +34,7 @@ gr.Interface( | |
| 36 | 
             
                fn = midi_ddsp_synth,
         | 
| 37 | 
             
                inputs = [
         | 
| 38 | 
             
                    gr.inputs.Textbox(
         | 
| 39 | 
            -
                        lines=1, placeholder=None, default='', label=' | 
| 40 | 
             
                                                                    flute, oboe, clarinet, saxophone, bassoon, trumpet, horn, trombone, tuba'),
         | 
| 41 | 
             
                    gr.File(type="file", label="Upload .mid file here")
         | 
| 42 | 
             
                ],
         | 
|  | |
|  | |
| 1 | 
             
            import os
         | 
| 2 | 
            +
            import gradio as gr
         | 
| 3 | 
             
            from midi_ddsp.midi_ddsp_synthesize import load_pretrained_model
         | 
| 4 | 
             
            from midi_ddsp.utils.midi_synthesis_utils import synthesize_mono_midi
         | 
| 5 | 
             
            from midi_ddsp.data_handling.instrument_name_utils import INST_NAME_TO_ID_DICT, INST_NAME_LIST
         | 
|  | |
| 10 | 
             
            def midi_ddsp_synth(instrument, midi_file):
         | 
| 11 | 
             
                '''
         | 
| 12 | 
             
                Paras:
         | 
| 13 | 
            +
                    midi_file: the directory of the midi file
         | 
| 14 | 
            +
                    instrument: instrument type, choose from 'violin', 'viola', 'cello', 'double bass',
         | 
| 15 | 
             
                                                        'flute', 'oboe', 'clarinet', 'saxophone',
         | 
| 16 | 
             
                                                        'bassoon', 'trumpet', 'horn', 'trombone', 'tuba'                                            
         | 
| 17 | 
             
                Returns:
         | 
| 18 | 
            +
                    output_file_path: path of the output wav file
         | 
|  | |
| 19 | 
             
                '''
         | 
| 20 | 
             
                if not (os.path.isfile(midi_file.name) and midi_file.name[-4:] == '.mid'):
         | 
| 21 | 
             
                    raise FileNotFoundError('Error: not a valid midi file')
         | 
|  | |
| 34 | 
             
                fn = midi_ddsp_synth,
         | 
| 35 | 
             
                inputs = [
         | 
| 36 | 
             
                    gr.inputs.Textbox(
         | 
| 37 | 
            +
                        lines=1, placeholder=None, default='', label='Input instrument type, choose from: violin, viola, cello, double bass,\
         | 
| 38 | 
             
                                                                    flute, oboe, clarinet, saxophone, bassoon, trumpet, horn, trombone, tuba'),
         | 
| 39 | 
             
                    gr.File(type="file", label="Upload .mid file here")
         | 
| 40 | 
             
                ],
         |