Spaces:
Runtime error
Runtime error
Download app.py from NadiaHassan/Trans: direct link, hf CLI and curl.
- Browser
- Download file 306 Bytes
-
https://huggingface.co/spaces/NadiaHassan/Trans/resolve/main/app.py
- Command line
-
hf download hf://spaces/NadiaHassan/Trans/app.py
-
curl -L -o app.py https://huggingface.co/spaces/NadiaHassan/Trans/resolve/main/app.py
306 Bytes
| from transformers import pipeline | |
| import gradio as grad | |
| mdl_name = "Helsinki-NLP/opus-mt-en-de" | |
| opus_translator = pipeline("translation", model=mdl_name) | |
| def translate(text): | |
| response = opus_translator(text) | |
| return response | |
| grad.Interface(translate, inputs=["text",], outputs="text").launch() |