sss2000 commited on
Commit
236bd5a
1 Parent(s): 41e5936

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -5,18 +5,18 @@ st.set_page_config(page_title="Your English audio to Chinese text", page_icon="
5
  st.header("Turn Your English Audio to Chinese text")
6
 
7
  # Function to convert audio to text
8
- @st.cache
9
  def audio2txt(audioname):
10
  pipe = pipeline("automatic-speech-recognition", model="avery0/pipeline1model2")
11
  rst = pipe(audioname)
12
  return rst['text']
13
 
14
  # Function to translate text
15
- @st.cache
16
  def translation(txt):
17
  pipe = pipeline("translation", model= "Helsinki-NLP/opus-mt-en-zh")
18
  rst = pipe(txt)
19
- return rst
20
 
21
  # Main function
22
  def main():
 
5
  st.header("Turn Your English Audio to Chinese text")
6
 
7
  # Function to convert audio to text
8
+ @st.cache_data
9
  def audio2txt(audioname):
10
  pipe = pipeline("automatic-speech-recognition", model="avery0/pipeline1model2")
11
  rst = pipe(audioname)
12
  return rst['text']
13
 
14
  # Function to translate text
15
+ @st.cache_data
16
  def translation(txt):
17
  pipe = pipeline("translation", model= "Helsinki-NLP/opus-mt-en-zh")
18
  rst = pipe(txt)
19
+ return rst["translation_text"]
20
 
21
  # Main function
22
  def main():