vox-explorer / app.py
jerpint's picture
Update app.py
06663d0 verified
import pandas as pd
import gradio as gr
csv_link = "https://huggingface.co/datasets/jerpint/vox-cloned-data/resolve/main/metadata-balanced.csv?download=true"
models = ["commonvoice", "xttsv2", "stylettsv2", "playht", "metavoice"]
def audio_markdown(x, model: str):
link = f"https://huggingface.co/datasets/jerpint/vox-cloned-data/resolve/main/{model}/{x.path}?download=true"
audio_md = f"""<audio controls>
<source src="{link}" type="audio/mpeg">
Your browser does not support the audio element.
</audio>"""
return audio_md
df = pd.read_csv(csv_link)
df["id"] = list(df.index) # Temporary id to visualize the index on the UI
for model in models:
df[model] = df.apply(lambda x: audio_markdown(x, model), axis=1)
with gr.Blocks() as demo:
gr.Dataframe(
value=df[
[
"id",
*models,
"path",
"sentence",
"gender",
"accents",
]
],
datatype="markdown",
row_count=10,
)
demo.launch()