hotdogtest / app.py
Edward Tang
testing
26e4765
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")