Spaces:
Runtime error
Runtime error
Download app.py from DoNotChoke/MachineTranslation: direct link, hf CLI and curl.
- Browser
- Download file 511 Bytes
-
https://huggingface.co/spaces/DoNotChoke/MachineTranslation/resolve/main/app.py
- Command line
-
hf download hf://spaces/DoNotChoke/MachineTranslation/app.py
-
curl -L -o app.py https://huggingface.co/spaces/DoNotChoke/MachineTranslation/resolve/main/app.py
511 Bytes
| import streamlit as st | |
| from transformers import pipeline | |
| pipe = pipeline(model="thainq107/en-vi-mbart50") | |
| st.title("Dịch với mô hình HuggingFace") | |
| user_input = st.text_area("Nhập đoạn văn tiếng Anh:", "") | |
| if st.button("Dịch"): | |
| if user_input: | |
| translated_text = pipe(user_input, num_beams=2, do_sample=False) | |
| result = translated_text[0]["generated_text"] | |
| st.write("Kết quả dịch:", result) | |
| else: | |
| st.write("Vui lòng nhập đoạn văn để dịch.") |