Download app.py from Spanifyd/spanifyd: direct link, hf CLI and curl.
- Browser
- Download file 763 Bytes
-
https://huggingface.co/spaces/Spanifyd/spanifyd/resolve/main/app.py
- Command line
-
hf download hf://spaces/Spanifyd/spanifyd/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Spanifyd/spanifyd/resolve/main/app.py
763 Bytes
| 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() | |