|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
|
|
inputs=gr.Audio(type="filepath") |
|
pipe = pipeline(model="TruongScotl/stvi") |
|
title = "Speech to Text Translation" |
|
description = """ |
|
<p> |
|
<center> |
|
Open your eyes Morty, that translator is mind-blowing. Drop the damn file, Morty! |
|
<img src="https://huggingface.co/spaces/course-demos/Rick_and_Morty_QA/resolve/main/rick.png" width=200px> |
|
</center> |
|
</p> |
|
""" |
|
|
|
def translate(audio): |
|
text = pipe(audio)["text"] |
|
return text |
|
|
|
translate = gr.Interface( |
|
fn=translate, |
|
inputs=inputs, |
|
outputs="text", |
|
title=title, |
|
description=description |
|
) |
|
|
|
translate.launch() |
|
|
|
|