Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| translation_pipeline = pipeline("translation_en_to_fr") | |
| result = translation_pipeline("I like mathematics and computers") | |
| result[0]["translation_text"] | |
| def translate_gradio(input): | |
| result = translation_pipeline(input) | |
| return result[0]['translation_text'] | |
| translate_interface = gr.Interface(fn = translate_gradio, | |
| inputs="text", | |
| outputs="text") | |
| translate_interface.launch() | |