File size: 763 Bytes
01d8c8d 30eb62a 01d8c8d 30eb62a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import gradio as gr
# Basic English-to-Spanish dictionary
def translate(word):
dictionary = {
"dog": "perro",
"cat": "gato",
"house": "casa",
"hello": "hola",
"goodbye": "adiós",
"thank you": "gracias",
"please": "por favor",
"water": "agua",
"food": "comida",
"school": "escuela"
}
return dictionary.get(word.lower().strip(), "🔍 Try a different word!")
# Gradio interface
gr.Interface(
fn=translate,
inputs=gr.Textbox(label="Type an English word"),
outputs=gr.Textbox(label="Spanish Translation"),
title="📚 Spanifyd Flashcard Translator",
description="Type a word in English to learn the Spanish word. More features coming soon!"
).launch()
|