Spaces:
Paused
Paused
File size: 1,212 Bytes
e511180 d6e1a9f e511180 f539cc5 cdf05c5 d6e1a9f 1917902 d6e1a9f 1917902 ab26a20 57826c1 0d1f258 b34763a 57826c1 26e4765 d00ecca 35c90c9 1917902 51c33c0 35c90c9 51c33c0 35c90c9 d00ecca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
import streamlit as st
from transformers import AutoProcessor, SeamlessM4TModel
st.title("Ed's not working Hot Dog? Or Not!!!!!?")
processor = AutoProcessor.from_pretrained("facebook/hf-seamless-m4t-large")
model = SeamlessM4TModel.from_pretrained("facebook/hf-seamless-m4t-large")
if "texttotranslate" not in st.session_state:
st.session_state.texttotranslate = ""
def submit():
st.write('method')
st.session_state.texttotranslate = st.session_state.widget
text_inputs = processor(text = st.session_state.texttotranslate, src_lang="eng", return_tensors="pt")
output_tokens = model.generate(**text_inputs, tgt_lang="fra", generate_speech=False)
translated_text_from_text = processor.decode(output_tokens[0].tolist()[0], skip_special_tokens=True)
st.write(translated_text_from_text)
st.text_input('hello', value="fat cats", key="widget", on_change=submit)
#text_inputs = processor(text = title, src_lang="eng", return_tensors="pt")
# from text
#output_tokens = model.generate(**text_inputs, tgt_lang="fra", generate_speech=False)
#translated_text_from_text = processor.decode(output_tokens[0].tolist()[0], skip_special_tokens=True)
#st.write(translated_text_from_text)
st.write("fool me")
|