Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import os | |
| WAVE_OUTPUT_FILE = "sample.wav" | |
| def list_file_sizes(): | |
| path = "." | |
| # Get list of all files only in the given directory | |
| fun = lambda x : os.path.isfile(os.path.join(path,x)) | |
| files_list = filter(fun, os.listdir(path)) | |
| # Create a list of files in directory along with the size | |
| size_of_file = [ | |
| (f,os.stat(os.path.join(path, f)).st_size) | |
| for f in files_list | |
| ] | |
| # Iterate over list of files along with size | |
| # and print them one by one. | |
| for f,s in size_of_file: | |
| print("{} : {}MB".format(f, round(s/(1024*1024),3))) | |
| def greet(audio): | |
| print(audio) | |
| list_file_sizes() | |
| return audio | |
| iface = gr.Interface(fn=greet, | |
| inputs=gr.inputs.Audio(source="microphone", type="filepath"), | |
| outputs="audio", | |
| layout="horizontal", | |
| theme="huggingface" | |
| ) | |
| iface.launch() |