Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,21 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
# Load the model
|
4 |
+
model = gr.load("models/facebook/xm_transformer_s2ut_hk-en")
|
5 |
+
|
6 |
+
# Define the translation function
|
7 |
+
def translate_hokkien_to_english(audio):
|
8 |
+
# Perform the translation using the loaded model
|
9 |
+
translation = model.predict(audio)
|
10 |
+
|
11 |
+
return translation
|
12 |
+
|
13 |
+
# Create a Gradio interface with a microphone input
|
14 |
+
iface = gr.Interface(
|
15 |
+
fn=translate_hokkien_to_english,
|
16 |
+
inputs=gr.Microphone(),
|
17 |
+
outputs="text"
|
18 |
+
)
|
19 |
+
|
20 |
+
# Launch the Gradio interface
|
21 |
+
iface.launch()
|