reallynicejam commited on
Commit
7efca7c
1 Parent(s): bc54eb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -1,3 +1,21 @@
1
  import gradio as gr
2
 
3
- gr.load("models/facebook/xm_transformer_s2ut_hk-en").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()