Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from libretranslatepy import LibreTranslateAPI | |
| lt = LibreTranslateAPI("https://translate.argosopentech.com/") | |
| def predict(text): | |
| lang_detected = lt.detect(text)[0]['language'] | |
| print(lang_detected) | |
| english_translated = lt.translate(text, lang_detected, "en") | |
| print(english_translated) | |
| return english_translated | |
| iface = gr.Interface( | |
| fn=predict, | |
| inputs='text', | |
| outputs='text', | |
| examples=[["Hola! Me llamo Dhruv"]] | |
| ) | |
| iface.launch() | |