Spaces:
Paused
Paused
Edward Tang
commited on
Commit
·
0d1f258
1
Parent(s):
f539cc5
testing
Browse files
app.py
CHANGED
@@ -12,14 +12,14 @@ if "texttotranslate" not in st.session_state:
|
|
12 |
|
13 |
def submit():
|
14 |
st.write('method')
|
15 |
-
|
16 |
-
text_inputs = processor(text =
|
17 |
output_tokens = model.generate(**text_inputs, tgt_lang="fra", generate_speech=False)
|
18 |
translated_text_from_text = processor.decode(output_tokens[0].tolist()[0], skip_special_tokens=True)
|
19 |
st.write(translated_text_from_text)
|
20 |
|
21 |
|
22 |
-
st.text_input('hello', "fat cats", on_change=submit)
|
23 |
|
24 |
|
25 |
|
|
|
12 |
|
13 |
def submit():
|
14 |
st.write('method')
|
15 |
+
st.session_state.texttotranslate = st.session_state.widget
|
16 |
+
text_inputs = processor(text = st.session_state.texttotranslate, src_lang="eng", return_tensors="pt")
|
17 |
output_tokens = model.generate(**text_inputs, tgt_lang="fra", generate_speech=False)
|
18 |
translated_text_from_text = processor.decode(output_tokens[0].tolist()[0], skip_special_tokens=True)
|
19 |
st.write(translated_text_from_text)
|
20 |
|
21 |
|
22 |
+
st.text_input('hello', key="widget", "fat cats", on_change=submit)
|
23 |
|
24 |
|
25 |
|