Spaces:
Runtime error
Runtime error
Download gradio.File from Taghrid/Translator: direct link, hf CLI and curl.
- Browser
- Download file 470 Bytes
-
https://huggingface.co/spaces/Taghrid/Translator/resolve/main/gradio.File
- Command line
-
hf download hf://spaces/Taghrid/Translator/gradio.File
-
curl -L -o gradio.File https://huggingface.co/spaces/Taghrid/Translator/resolve/main/gradio.File
470 Bytes
| import logging | |
| import gradio as gr | |
| from model import Translator | |
| model_path = 'model.h5' | |
| model = Translator(model_path) | |
| logging.basicConfig(level=logging.INFO) | |
| def translate_sentence(input_sentence): | |
| return model.predict(input_sentence) | |
| inputs = gr.Textbox(lines=2, label="Input Text") | |
| outputs = gr.Textbox(lines=4, label="Translated Text") | |
| gr.Interface( | |
| fn=translate_sentence, | |
| inputs=inputs, | |
| outputs=outputs, | |
| allow_flagging="never" | |
| ).launch() | |