Edward Tang commited on
Commit
57826c1
·
1 Parent(s): b04b349
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -7,8 +7,17 @@ processor = AutoProcessor.from_pretrained("facebook/hf-seamless-m4t-large")
7
 
8
  model = SeamlessM4TModel.from_pretrained("facebook/hf-seamless-m4t-large")
9
 
 
 
 
 
 
 
 
 
 
10
  title = "my dog is fat"
11
- title = st.text_input('hello', "Hello, my dog is cute")
12
 
13
 
14
 
 
7
 
8
  model = SeamlessM4TModel.from_pretrained("facebook/hf-seamless-m4t-large")
9
 
10
+ def submit():
11
+ st.write('method')
12
+ mytitle = st.session_state.title
13
+ text_inputs = processor(text = mytitle, src_lang="eng", return_tensors="pt")
14
+ output_tokens = model.generate(**text_inputs, tgt_lang="fra", generate_speech=False)
15
+ translated_text_from_text = processor.decode(output_tokens[0].tolist()[0], skip_special_tokens=True)
16
+ st.write(translated_text_from_text)
17
+
18
+
19
  title = "my dog is fat"
20
+ title = st.text_input('hello', "fat cats", on_change=submit)
21
 
22
 
23