Edward Tang commited on
Commit
d6e1a9f
·
1 Parent(s): 5e627cf
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -1,19 +1,18 @@
1
  import streamlit as st
2
- from transformers import AutoProcessor, SeamlessM4Tv2ForTextToText
3
 
4
- st.title("Hot Dog? Or Not!?")
5
 
6
- processor = AutoProcessor.from_pretrained("facebook/seamless-m4t-v2-large")
7
 
8
- model = SeamlessM4Tv2ForTextToText.from_pretrained("facebook/seamless-m4t-v2-large")
9
 
10
 
11
  text_inputs = processor(text = "Hello, my dog is cute", src_lang="eng", return_tensors="pt")
12
 
13
  # from text
14
- output_tokens = model.generate(**text_inputs, tgt_lang="fra")
15
- translated_text_from_text = processor.decode(output_tokens[0].tolist()[0], skip_special_tokens=True)
16
-
17
 
18
  st.write(translated_text_from_text)
19
  st.write("fool me")
 
1
  import streamlit as st
2
+ from transformers import AutoProcessor, SeamlessM4TModel
3
 
4
+ st.title("Hot Dog? Or Not!!!?")
5
 
6
+ processor = AutoProcessor.from_pretrained("facebook/hf-seamless-m4t-large")
7
 
8
+ model = SeamlessM4TModel.from_pretrained("facebook/hf-seamless-m4t-large")
9
 
10
 
11
  text_inputs = processor(text = "Hello, my dog is cute", src_lang="eng", return_tensors="pt")
12
 
13
  # from text
14
+ output_tokens = model.generate(**text_inputs, tgt_lang="fra", generate_speech=False)
15
+ translated_text_from_text = processor.decode(output_tokens[0].tolist(), skip_special_tokens=True)
 
16
 
17
  st.write(translated_text_from_text)
18
  st.write("fool me")