Untitled

 avatar
unknown
python
2 years ago
527 B
4
Indexable
if target_lgs == source_lgs:
        st.warning('Selected language can not be equal to source language', icon="⚠️")
        trans_code = content
    else:
        trans_code = request_api(
            url=API,
            _input=content,
            task='translate',
            source_lgs=source_lgs,
            target_lgs=target_lgs
        )
        trans_code = json.loads(trans_code.text)
        trans_code = trans_code['output']
        
st.write("Translated Code")
st.code(trans_code, language=target_lgs.lower())
Editor is loading...