Download app.py from Thanatcha/lab10: direct link, hf CLI and curl.
- Browser
- Download file 499 Bytes
-
https://huggingface.co/spaces/Thanatcha/lab10/resolve/main/app.py
- Command line
-
hf download hf://spaces/Thanatcha/lab10/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Thanatcha/lab10/resolve/main/app.py
499 Bytes
| import streamlit as st | |
| from transformers import pipeline | |
| classifier = pipeline("translation", model="Helsinki-NLP/opus-mt-th-en") | |
| def main(): | |
| st.title("Translation Thai to Eng") | |
| with st.form("text_field"): | |
| text = st.text_area('enter some Thai text:') | |
| # clicked==True only when the button is clicked | |
| clicked = st.form_submit_button("Submit") | |
| if clicked: | |
| results = classifier([text]) | |
| st.json(results) | |
| if __name__ == "__main__": | |
| main() |