File size: 1,176 Bytes
91428a3
 
21c0ae2
4005740
ffd9653
4005740
 
91428a3
4005740
 
ffd9653
4005740
 
 
ffd9653
 
 
 
 
 
 
 
 
 
 
 
4005740
 
 
 
 
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
# have to run this locally as streamlit run app.py
import streamlit as st
from Autocorrect.autocorrectreal import edit
from TestTranslation.translation import *
from TestTranslationChinese.translation_model import decode_sequence_chinese


st.title("Translation model test")

option = st.selectbox("Select input type:", ("text input", "audio input"))
option2 = st.selectbox("Select translation language:", ("Spanish", "Chinese"))
if option == "text input":
    input_sentence = st.text_input("Enter input sentence:")
    if input_sentence is not None and len(input_sentence) > 0:
        if option2 == "Spanish":
            edited = edit(input_sentence)
            st.write("Autocorrected sentence: " + edited)
            translated = decode_sequence(edited)[8:-5]
            st.write(translated)
            input_sentence = None
        else:
            edited = edit(input_sentence)
            st.write("Autocorrected sentence: " + edited)
            translated = decode_sequence_chinese(edited)[8:]
            st.write(translated)
            input_sentence = None
else:
    wav_sentence = st.file_uploader("Upload a wav file:")
    st.button("Submit wav file")