Spaces:
Sleeping
Sleeping
File size: 993 Bytes
9505cca 52985bb 9505cca a9bf14f 52985bb a9bf14f 9505cca a9bf14f 9505cca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
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):
with open(WAVE_OUTPUT_FILE, "wb") as file:
file.write(audio)
return audio
iface = gr.Interface(fn=greet,
inputs=gr.inputs.Audio(source="microphone", type="filepath"),
outputs="audio",
layout="horizontal",
theme="huggingface"
)
iface.launch() |