File size: 498 Bytes
bc54eb5
 
7efca7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr

# Load the model
model = gr.load("models/facebook/xm_transformer_s2ut_hk-en")

# Define the translation function
def translate_hokkien_to_english(audio):
    # Perform the translation using the loaded model
    translation = model.predict(audio)

    return translation

# Create a Gradio interface with a microphone input
iface = gr.Interface(
    fn=translate_hokkien_to_english,
    inputs=gr.Microphone(),
    outputs="text"
)

# Launch the Gradio interface
iface.launch()