DoNotChoke's picture
Update app.py
f063c66 verified
raw
history blame contribute delete
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.")