Spaces:
Runtime error
Runtime error
import gradio as gr | |
from gradio import mix | |
from gradio import inputs, outputs # noqa: F401 | |
import hydra | |
from omegaconf import DictConfig | |
from models_evaluation.models import BaseModel | |
def main(cfg: DictConfig): | |
audio_input = gr.inputs.Audio(source=cfg.gradio.source, type="file", label="Audio") | |
default_kwargs = { | |
"theme": "dark-huggingface", | |
"allow_flagging": "manual", | |
"title": cfg.gradio.title, | |
} | |
all_io = [] | |
models = [] | |
for model_cfg in cfg.models: | |
model = hydra.utils.instantiate(model_cfg) # type: BaseModel | |
model_cfg = model_cfg.cfg | |
models.append(model) | |
io = gr.Interface( | |
model.transcribe, inputs=audio_input, outputs=gr.outputs.JSON(label=model_cfg.name) | |
) | |
all_io.append(io) | |
parallel = mix.Parallel(*all_io, **default_kwargs) | |
parallel.launch(share=True, debug=True) | |
if __name__ == "__main__": | |
main() | |