Spaces:
Runtime error
Runtime error
Download app.py from KateProxa/translator: direct link, hf CLI and curl.
- Browser
- Download file 614 Bytes
-
https://huggingface.co/spaces/KateProxa/translator/resolve/main/app.py
- Command line
-
hf download hf://spaces/KateProxa/translator/app.py
-
curl -L -o app.py https://huggingface.co/spaces/KateProxa/translator/resolve/main/app.py
614 Bytes
| import io | |
| import streamlit as st | |
| from transformers import pipeline | |
| def load_model(): | |
| return pipeline("translation_en_to_de", model = "Helsinki-NLP/opus-mt-en-de") | |
| translation = load_model() | |
| st.title('Translator to Deutch') | |
| st.header('Это приложение для перевода текста на немецкий язык') | |
| text = st.text_input('Введите текст для перевода на английском языке') | |
| result = st.button('Перевести') | |
| if result: | |
| tr_text = translation(text) | |
| st.write("Перевод:", tr_text[0]['translation_text']) | |