Spanifyd commited on
Commit
30eb62a
路
verified 路
1 Parent(s): d3eb7fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -7
app.py CHANGED
@@ -1,10 +1,26 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return f"隆Hola {name}! Welcome to Spanifyd."
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- gr.Interface(fn=greet,
7
- inputs="text",
8
- outputs="text",
9
- title="馃憢 Spanifyd Demo Tool",
10
- description="Type your name and get a friendly greeting!").launch()
 
 
 
 
1
  import gradio as gr
2
 
3
+ # Basic English-to-Spanish dictionary
4
+ def translate(word):
5
+ dictionary = {
6
+ "dog": "perro",
7
+ "cat": "gato",
8
+ "house": "casa",
9
+ "hello": "hola",
10
+ "goodbye": "adi贸s",
11
+ "thank you": "gracias",
12
+ "please": "por favor",
13
+ "water": "agua",
14
+ "food": "comida",
15
+ "school": "escuela"
16
+ }
17
+ return dictionary.get(word.lower().strip(), "馃攳 Try a different word!")
18
 
19
+ # Gradio interface
20
+ gr.Interface(
21
+ fn=translate,
22
+ inputs=gr.Textbox(label="Type an English word"),
23
+ outputs=gr.Textbox(label="Spanish Translation"),
24
+ title="馃摎 Spanifyd Flashcard Translator",
25
+ description="Type a word in English to learn the Spanish word. More features coming soon!"
26
+ ).launch()