Fixed an error in the code
Browse files
app.py
CHANGED
@@ -111,6 +111,7 @@ def show_available(filepath,format=None):
|
|
111 |
|
112 |
def upload_file(file):
|
113 |
audio_formats = ['.wav', '.mp3', '.ogg', '.flac', '.aac']
|
|
|
114 |
try:
|
115 |
_, ext = os.path.splitext(file.name)
|
116 |
filename = os.path.basename(file.name)
|
@@ -156,7 +157,7 @@ with gr.Blocks() as app:
|
|
156 |
audio_picker = gr.Dropdown(label="",choices=show_available('audios'),value='',interactive=True)
|
157 |
recorder.stop_recording(upload_file, inputs=[recorder],outputs=[audio_picker])
|
158 |
with gr.TabItem("(Or upload a new file here)"):
|
159 |
-
dropbox = gr.Audio(label="Drop an audio here.",sources=['upload'])
|
160 |
dropbox.upload(fn=upload_file, inputs=[dropbox],outputs=[audio_picker])
|
161 |
audio_refresher = gr.Button("Refresh")
|
162 |
audio_refresher.click(fn=refresh,inputs=[],outputs=[audio_picker,model_picker])
|
|
|
111 |
|
112 |
def upload_file(file):
|
113 |
audio_formats = ['.wav', '.mp3', '.ogg', '.flac', '.aac']
|
114 |
+
print(file)
|
115 |
try:
|
116 |
_, ext = os.path.splitext(file.name)
|
117 |
filename = os.path.basename(file.name)
|
|
|
157 |
audio_picker = gr.Dropdown(label="",choices=show_available('audios'),value='',interactive=True)
|
158 |
recorder.stop_recording(upload_file, inputs=[recorder],outputs=[audio_picker])
|
159 |
with gr.TabItem("(Or upload a new file here)"):
|
160 |
+
dropbox = gr.Audio(label="Drop an audio here.",sources=['upload'], type="filepath")
|
161 |
dropbox.upload(fn=upload_file, inputs=[dropbox],outputs=[audio_picker])
|
162 |
audio_refresher = gr.Button("Refresh")
|
163 |
audio_refresher.click(fn=refresh,inputs=[],outputs=[audio_picker,model_picker])
|