File size: 629 Bytes
fa97825
9f724f2
fa97825
9f724f2
 
4c54e46
9f724f2
a4f8690
37195cf
 
9f724f2
a4f8690
37195cf
 
a4f8690
83505ca
9f724f2
 
 
 
 
 
 
 
 
 
 
 
 
83505ca
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
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()